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

[cspell-types] Interfaces *Source incorrectly extends interface BaseSource #2011

Closed
3 of 19 tasks
david-bojnansky opened this issue Nov 23, 2021 · 6 comments · Fixed by #2013
Closed
3 of 19 tasks

[cspell-types] Interfaces *Source incorrectly extends interface BaseSource #2011

david-bojnansky opened this issue Nov 23, 2021 · 6 comments · Fixed by #2013

Comments

@david-bojnansky
Copy link

david-bojnansky commented Nov 23, 2021

Info

Kind of Issue

  • runtime - command-line tools
  • building / compiling
  • security
  • change in behavior
  • crash / error

Which Tool or library

  • cspell -- the command-line spelling tool
  • cspell-tools -- used for building dictionary files
  • cspell-lib -- library that does the actual spell checking.
  • cspell-trie -- tool for working with trie files.

Which Version

Version: 5.13.0

Issue with supporting library?

  • No
  • cspell-glob -- library for matching glob patterns
  • cspell-io -- thin file i/o library
  • cspell-trie-lib - trie lib
  • cspell-trie2-lib - trie lib alternate format
  • cspell-types

OS:

  • Macos
  • Linux
  • Windows
  • Other

Bug Description

Describe the bug

Interfaces *Source incorrectly extends interface BaseSource.

Possible Solution

If possible, remove extends BaseSource as below.

or

add before each problematic interface // @ts-expect-error TS2430.

Screenshots

extends BaseSource causes an error:
extends BaseSource

without extends BaseSource:
no extends BaseSource

@Jason3S
Copy link
Collaborator

Jason3S commented Nov 23, 2021

@david-bojnansky,

Thank you. I'll take a look.

@Jason3S
Copy link
Collaborator

Jason3S commented Nov 23, 2021

@david-bojnansky,

I'm not able to reproduce this. Do you have a sample repo with the problem?

What version of Typescript are you using?

Kind regards,
Jason

@david-bojnansky
Copy link
Author

david-bojnansky commented Nov 24, 2021

@Jason3S,

I just install the @cspell/cspell-types as (dev-)dependency and in my one .d.ts file I do import type { FileSettings } from '@cspell/cspell-types'. TypeScript checks also your .d.ts (though it is in node_modules/) and finds the errors. I could set skipLibCheck to true in my tsconfig.json but it also stops to check all my local .d.ts files and that's unwanted for me.

Yeah, I got what the problem is. I cloned your repository and add "exactOptionalPropertyTypes": true to tsconfig.json (because in my tsconfig.json it is there) and the errors raise up.

TypeScript: 4.5.2

@Jason3S
Copy link
Collaborator

Jason3S commented Nov 24, 2021

Yeah, I got what the problem is. I cloned your repository and add "exactOptionalPropertyTypes": true to tsconfig.json (because in my tsconfig.json it is there) and the errors raise up.

"exactOptionalPropertyTypes": true - That is it! Thank you.

Hmm, I need to find a workaround for that. I'm not sure if it is possible. That is the whole point of extending the base is to turn an optional property into a required one.

Jason3S added a commit that referenced this issue Nov 24, 2021
Turn on `exactOptionalPropertyTypes` for types.
@Jason3S Jason3S linked a pull request Nov 24, 2021 that will close this issue
Jason3S added a commit that referenced this issue Nov 24, 2021
Turn on `exactOptionalPropertyTypes` for types.
@david-bojnansky
Copy link
Author

Thanks.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants