-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
Help WantedYou can do thisYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
Description
π Search Terms
export let
, undefined
, assignment, assigned
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about
export let
β― Playground Link
No response
π» Code
// a.ts
export let x: { foo(): void }
if (!!false) {
// @ts-expect-error Variable 'x' is used before being assigned.
x.foo()
}
// b.ts
import { x } from './a.ts'
// TS compiles, throws at runtime
x.foo()
π Actual behavior
TS compiles, only throws at runtime.
π Expected behavior
TS refuses to compile without !
non-null assertion, with error probably being reported in the exporting module a.ts
rather than the importing module b.ts
.
Additional information about the issue
No response
kirkwaiblinger
Metadata
Metadata
Assignees
Labels
Help WantedYou can do thisYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases