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

Support definite assignment in TypesScript 2.7 #9

Open
NN--- opened this issue Jan 28, 2018 · 1 comment
Open

Support definite assignment in TypesScript 2.7 #9

NN--- opened this issue Jan 28, 2018 · 1 comment
Labels

Comments

@NN---
Copy link

NN--- commented Jan 28, 2018

Starting TypeScript 2.7 there is a special syntax for definite assignment.
https://blogs.msdn.microsoft.com/typescript/2018/01/17/announcing-typescript-2-7-rc/

TSLint should recognize this pattern and not issue error of noUninitialized.
In other words this should trigger this automatically: // tslint:disable-next-line no-uninitialized

class C {
    foo!: number;
}

From: palantir/tslint#3679

@alhugone
Copy link
Owner

alhugone commented Mar 3, 2018

The problem with definite assignment is that it again breaks strict-null-checks guarantees:

class C {
    foo!: number;
}

this code compiles despite that foo will be undefined. I see two options:

  1. My rules are no loger needed - the compiler has this builtin check
    or/and
  2. Don't use definite assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants