Skip to content

fix(@schematics/angular): enable TypeScript skipLibCheck in new workspace #26546

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

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Dec 1, 2023

This commit enables skipLibCheck in new workspaces which is now recommended by TypeScript. When enabled, type checking of declaration files is skipped as rather than doing a full check of all d.ts files, TypeScript will type check the code you specifically refer to in your app’s source code.

See: https://www.typescriptlang.org/tsconfig#skipLibCheck

Note: this option is also enabled by default when running tsc --init

npx tsc --init               

Created a new tsconfig.json with: TS 
  target: es2016
  module: commonjs
  strict: true
  esModuleInterop: true
  skipLibCheck: true
  forceConsistentCasingInFileNames: true

Some more context: microsoft/TypeScript-Website#970

…kspace

This commit enables `skipLibCheck` in new workspaces which is now recommanded by TypeScript.  When enabled, type checking of declaration files is skipped as rather than doing a full check of all `d.ts` files, TypeScript will type check the code you specifically refer to in your app’s source code.

See: https://www.typescriptlang.org/tsconfig#skipLibCheck
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release needs: discussion On the agenda for team meeting to determine next steps labels Dec 1, 2023
@clydin
Copy link
Member

clydin commented Dec 1, 2023

Should we only do this in the build itself? I could see the potential errors being useful in the IDE.

@alan-agius4
Copy link
Collaborator Author

Should we only do this in the build itself? I could see the potential errors being useful in the IDE.

The LS will not report errors in DTS files.

@clydin
Copy link
Member

clydin commented Dec 1, 2023

In that case, i don't think there is a compelling reason not to enable it by default especially if tsc --init does so as well.

@alan-agius4 alan-agius4 removed the needs: discussion On the agenda for team meeting to determine next steps label Dec 1, 2023
@alan-agius4 alan-agius4 requested review from dgp1130 and clydin December 1, 2023 15:26
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Dec 1, 2023
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 1, 2023
Copy link
Collaborator

@dgp1130 dgp1130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we should figure out whether we want to migrate existing apps to enable skipLibCheck too, but that doesn't need to block this.

@dgp1130 dgp1130 merged commit e2f92ab into angular:main Dec 2, 2023
@alan-agius4 alan-agius4 deleted the skip-lib-check branch December 2, 2023 07:56
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants