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

TypeScript 2.7 introduces the definite property assignment assertion operator (!) #7157

Closed
DanielRosenwasser opened this Issue Jan 4, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@DanielRosenwasser

DanielRosenwasser commented Jan 4, 2018

While I am actually enthusiastic, the ! in the title actually has more to do with the syntax. TypeScript 2.7 permits a bang following any class property declaration.

class C {
  foo!: number;
  constructor() {
  }
}

The above is an example of such usage. It asserts that foo will be initialized even if it is not initialized within the constructor.

On the other hand, this is only allowed on class instance properties

class C {
  static foo!: number; // TypeScript errors: A definite assignment assertion '!' is not permitted in this context.
}

@andy-ms, can you take this on before the 7.0 release?

@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Jan 4, 2018

Collaborator

Hey @DanielRosenwasser! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

Collaborator

babel-bot commented Jan 4, 2018

Hey @DanielRosenwasser! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@DanielRosenwasser DanielRosenwasser changed the title from TypeScript 2.6 introduces the definite property assignment assertion operator (!) to TypeScript 2.7 introduces the definite property assignment assertion operator (!) Jan 4, 2018

@hzoo

This comment has been minimized.

Show comment
Hide comment
@hzoo

hzoo Oct 2, 2018

Member

Done with #7159?

Member

hzoo commented Oct 2, 2018

Done with #7159?

@hzoo hzoo closed this Oct 2, 2018

@epeli

This comment has been minimized.

Show comment
Hide comment
@epeli

epeli Oct 2, 2018

Yeah it's good! 💪

epeli commented Oct 2, 2018

Yeah it's good! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment