We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object is possibly 'null'
Describe the bug The following code:
<script lang="ts"> type User = { name: any } | null let user: User = { name: new Promise((resolve) => { setTimeout(() => { resolve('probablykasper') }, 1000) }) } </script> {#if user} {#await user.name} Loading username {:then name} Username: {name} {/await} {/if}
results in this TypeScript error:
To Reproduce Repo: https://github.com/probablykasper/svelte-typescript-possibly-null-bug
Expected behavior When await user.name is inside an if user block, user cannot be null, so there should not be any TypeScript warning
await user.name
if user
user
System (please complete the following information):
svelte-check
The text was updated successfully, but these errors were encountered:
Similar issues: #619, #493
Sorry, something went wrong.
(fix) control flow for awaited promise
9a6e16e
By surrounding the generated block with an if-condition sveltejs#880
(fix) control flow for awaited promise (#884)
7ccc6b4
By surrounding the generated block with an if-condition #880
No branches or pull requests
Describe the bug
The following code:
results in this TypeScript error:
To Reproduce
Repo: https://github.com/probablykasper/svelte-typescript-possibly-null-bug
Expected behavior
When
await user.name
is inside anif user
block,user
cannot be null, so there should not be any TypeScript warningSystem (please complete the following information):
svelte-check
The text was updated successfully, but these errors were encountered: