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

proposal: add ' min-tsc-version' config on d.ts file and tsconfig.json #10022

Closed
WanderWang opened this issue Jul 29, 2016 · 3 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@WanderWang
Copy link

WanderWang commented Jul 29, 2016

consider this code :

//some-lib.d.ts
declare function foo():number | undefined
//a.ts
foo();

when somebody use some-lib.d.ts with tsc1.8 , they will got a exception some-lib.d.ts(1,33): error TS2304: Cannot find name 'undefined'. . And they will be confused because they may not know about strict-null features in TypeScript 2.0

So I think we should add a 'min-tsc-version' on d.ts file , for example :

//some-lib.d.ts


/// min-tsc-version : 2.0.0
declare function foo():number | undefined
//tsconfig.json
{
    “compileOption": {
        "min-tsc-version":2.0.0
    }
}
@yahiko00
Copy link

yahiko00 commented Jul 29, 2016

Although I dislike the option name "min-tsc-version", why not. A kind of compatibility system could be helpful to manage our codebase.

@WanderWang
Copy link
Author

Another user story :

We write some typescript code with ts2.0 features , and VSCode .

becauseof vscode use TypeScript 1.8.10 now , so my code will got some error message from tss 1.8 ( including in vscode ) .

If here is a " min-tsc-version " in tsconfig.json , VSCode could report a friendly error message to let developers set custom typescript-sdk path in VSCode

@mhegazy
Copy link
Contributor

mhegazy commented Sep 2, 2016

the problem is it is not guaranteed to fail. so in most cases you will get the warning and will find it annoying.

you can see similar discussion in #10412, #6702 (comment) and in #7573.

@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 16, 2016
@mhegazy mhegazy closed this as completed Dec 16, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants