Skip to content

TypeScript error when importing TypeScript #48504

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

Closed
bbrk24 opened this issue Mar 31, 2022 · 3 comments Β· Fixed by #48505
Closed

TypeScript error when importing TypeScript #48504

bbrk24 opened this issue Mar 31, 2022 · 3 comments Β· Fixed by #48505
Assignees
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@bbrk24
Copy link

bbrk24 commented Mar 31, 2022

Bug Report

πŸ”Ž Search Terms

LanguageServiceHost useCaseSensitiveFileNames

πŸ•— Version & Regression Information

  • This changed between versions 4.7.0-dev.20220311 and 4.7.0-dev.20220312

⏯ Playground Link

N/A, requires import statement which isn't possible in the playground

πŸ’» Code

import * as ts from 'typescript';

Yep, that's it.

πŸ™ Actual behavior

The following error is generated:

node_modules/typescript/lib/typescript.d.ts:5716:15 - error TS2430: Interface 'LanguageServiceHost' incorrectly extends interface 'MinimalResolutionCacheHost'.  Types of property 'useCaseSensitiveFileNames' are incompatible.
    Type '(() => boolean) | undefined' is not assignable to type 'boolean | (() => boolean)'.
      Type 'undefined' is not assignable to type 'boolean | (() => boolean)'.

5716     interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalResolutionCacheHost {
                   ~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/typescript/lib/typescript.d.ts:5716

πŸ™‚ Expected behavior

TypeScript should compile without errors.

@bbrk24
Copy link
Author

bbrk24 commented Mar 31, 2022

It seems the problematic inheritance was added in commit d1fa945.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript API Relates to the public API for TypeScript labels Mar 31, 2022
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.7.0 milestone Mar 31, 2022
@weswigham
Copy link
Member

OK, I understand why our CI and builds don't catch this - this error only appears with exactOptionalPropertyTypes set. @RyanCavanaugh are we, uh, supposed to have our API be safe under this flag? We don't build with it ourselves...

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Mar 31, 2022
@RyanCavanaugh
Copy link
Member

We should probably try to turn it on 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants