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

Compile libraries with --strict=false, but compile src with --strict #33177

Closed
5 tasks done
ORESoftware opened this issue Aug 31, 2019 · 5 comments
Closed
5 tasks done
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript

Comments

@ORESoftware
Copy link

ORESoftware commented Aug 31, 2019

Search Terms

strict mode, strict, skipLibCheck

Suggestion

Allow uses to use:

skipLibCheck: false,
libCheckMode: 'non-strict' 

what it means is users want to re-compile library code (for some reason?), but want to switch strict mode off for library code.

Use Cases

I maintain a few libraries written in TS and sometimes users will say my library doesn't compile in strict mode. I prefer to not use strict mode. So I can tell my users to use compilerOptions.skipLibCheck = true, but sometimes they don't want to skipLibCheck, so it would be nice for them to skip strict checking for libraries, but do strict checking for their own code?

important: I may have a misunderstanding - it could be that tsconfig.json in node_modules projects override the end-user's settings, so perhaps I can prevent strict mode for library, in the case that my library only compiles in non-strict mode?

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@sandersn
Copy link
Member

sandersn commented Sep 3, 2019

No, you are right, all files in a compilation have to use the same settings. There is no way for a library to compile in non-strict, but have source compile in strict.

@sandersn sandersn added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Sep 3, 2019
@ORESoftware
Copy link
Author

Ok thanks.

Then this would be a feature request - it would be nice to compile libraries in strict and source in non-strict, or vice versa. Even compiling certain libraries as strict and certain ones as non-strict, perhaps according to their tsconfig.json files (if those are not excluded by .npmignore etc).

@sandersn sandersn changed the title Compile libraries with --script=false, but compile src with --strict Compile libraries with --strict=false, but compile src with --strict Sep 4, 2019
@sandersn
Copy link
Member

sandersn commented Sep 4, 2019

I thought we had seen this request before but I can't find it. This is a surprisingly complex feature, so we need some kind of proposal that thinks through the issues.

@sandersn sandersn added the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Sep 4, 2019
@MartinJohns
Copy link
Contributor

@sandersn You were probably thinking of #31035.

@sandersn
Copy link
Member

sandersn commented Sep 4, 2019

Yep, that's it. Thanks @MartinJohns

@sandersn sandersn closed this as completed Sep 4, 2019
@sandersn sandersn added Duplicate An existing issue was already created and removed Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants