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

Missing typescript definitions #2341

Closed
7 of 18 tasks
SLKnutson opened this issue Jan 26, 2022 · 6 comments · Fixed by #2343
Closed
7 of 18 tasks

Missing typescript definitions #2341

SLKnutson opened this issue Jan 26, 2022 · 6 comments · Fixed by #2343

Comments

@SLKnutson
Copy link

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.16.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

OS:

  • Macos
  • Linux
  • Windows
  • Other

version:

Any

Bug Description

cspell-lib types definitions reference Mandatory and PartialWithUndefined types which are not packaged with the library. Projects using it directly fail to compile with typescript errors like:

error TS2304: Cannot find name 'Mandatory'.

56 export declare function clean<T>(t: T): Mandatory<T>;

To Reproduce

Steps to reproduce the behavior:

  1. Add dependency "cspell-lib": "^5.16.0",
  2. Use it somewhere in your project
  3. Try to compile using typescript

Expected behavior

Compile should succeed

Additional context

I think the issue is that the new types.d.ts file where these types are defined are not included in the index.ts file. I'm not sure why this doesn't get caught as part of the library build process.

Thanks!!!

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 26, 2022

@SLKnutson,

The file was shipped, but I have no idea why it wasn't picked up by the compiler.

I made a few changes so it is explicitly imported to fix this.

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 26, 2022

I have several projects that build cspell-lib, so I was a bit confused that they work and yours do not.

I think I found it. I use @tsconfig/node14 as the base for those projects.

It has the following line:

"skipLibCheck": true,

That effectively mutes issues like you are seeing.

@SLKnutson
Copy link
Author

@Jason3S That makes sense. I was curious why it wasn't blowing up on your end but couldn't find any skipLibCheck and didn't notice the base config.

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 26, 2022

@SLKnutson,

I have published 5.17.0-alpha.0. Please try that one out. I will publish 5.17.0 soon.

@SLKnutson
Copy link
Author

SLKnutson commented Jan 26, 2022

@Jason3S
Looks like my type checking / full CI run without errors using 5.17.0-alpha.0.
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 Feb 26, 2022
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