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

Request : Progressive support for strictNullCheck #11386

Closed
olamothe opened this issue Oct 5, 2016 · 2 comments
Closed

Request : Progressive support for strictNullCheck #11386

olamothe opened this issue Oct 5, 2016 · 2 comments
Labels
Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript

Comments

@olamothe
Copy link

olamothe commented Oct 5, 2016

Feature Request/Suggestion

As an existing user of TypeScript, I would like to be able to gradually enable the new compiler options for strict null check in my project. As of now, the only way to do this that I'm aware of is to set the global flag strictNullCheck to true for the compiler, for the whole project.

For an already existing project with a big codebase, this becomes a monumental task to fix every single file before being able to use this feature going forward.

TypeScript Version : Currently using 2.0.3

Expected behaviour

Add support for special annotation in .ts files, a bit like Facebook's Flow annotation system.

For example, if the first line in a file contains an annotation like this :

/* @strictNullCheck */

This would tell the compiler to activate this option for this file only.

This could very well be expanded for other compiler options.

This would allow a big codebase to gradually migrate less painfully.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Oct 5, 2016
@RyanCavanaugh
Copy link
Member

As outlined here #9432 (comment) , there isn't a well-defined way to determine what would or wouldn't be an error under this flag. We'd need some way of guessing at whether or not to issue an error in a particular place.

@RyanCavanaugh
Copy link
Member

Declined in #8405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants