Skip to content
New issue

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

Static property is possibly undefined but error is not caught #42148

Closed
millsp opened this issue Dec 29, 2020 · 1 comment
Closed

Static property is possibly undefined but error is not caught #42148

millsp opened this issue Dec 29, 2020 · 1 comment

Comments

@millsp
Copy link
Contributor

millsp commented Dec 29, 2020

Bug Report

πŸ”Ž Search Terms

static property error undefined

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about static properties

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class A {
    hello() {}
}

class B {
    static a: A
}

B.a.hello() // crash

πŸ™ Actual behavior

Crash because ts assumed that the static property was not undefined

πŸ™‚ Expected behavior

Either require a definite assignment assertion or an inline assignment

@MartinJohns
Copy link
Contributor

Duplicate of #27899. Search terms: static undefined

@millsp millsp closed this as completed Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants