You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have done external checks and I am pretty sure someKey cannot be null, but TS would not compile it, because Object is possibly 'null'.. It would be very handy to write data.someKey!.toUpperCase(), but currently it is not possible.
Describe the solution you'd like
support the operator would be the best option
add the possibility of ignoring the following line in Typescript (@ts-ignore in html comment). It may be a separate feature request as well
Describe alternatives you've considered
For now I see no other alternatives. The only one is to have excessive checks in {#if} tags.
The text was updated successfully, but these errors were encountered:
Oh this is a tough one. The problem is that at the moment mustache tags are not preprocessed, so you cannot use anything other than basic JavaScript in there. There is an issue about this in the main repo sveltejs/svelte#4701 . Your proposal about @ts-ignore could work but feels very hacky, not sure about that. Do others have opinions on this?
* (docs) restructure, more faq/troubleshooting
- The docs now live at `docs`, to prevent duplication
- Added troubleshooting/faq section to typescript
- Added link to docs in `svelte-check`
#271, #272
* bump svelte-preprocess version
tsignore would probably not work as intended sometimes.
Also, I think there are a lot of workaround for situation that you have to use typescript in template. In many cases it could be done in script instead.
I feel the same. I'm going to close this then. It seems like template/mustache preprocessing is being worked on soon, so let's wait and use workarounds in the meantime. Sorry @dkzlv that we cannot fix this right now.
Is your feature request related to a problem? Please describe.
Not-null assertion operator, or simply put, the exclamation mark.
Take this code as an example:
I have done external checks and I am pretty sure
someKey
cannot benull
, but TS would not compile it, becauseObject is possibly 'null'.
. It would be very handy to writedata.someKey!.toUpperCase()
, but currently it is not possible.Describe the solution you'd like
@ts-ignore
in html comment). It may be a separate feature request as wellDescribe alternatives you've considered
For now I see no other alternatives. The only one is to have excessive checks in
{#if}
tags.The text was updated successfully, but these errors were encountered: