Skip to content

skipLibCheck: true is ignored when package's types field points to a .ts file (not a .d.ts declaration file) #41883

Closed
@trusktr

Description

@trusktr

TypeScript Version: 3.9.7

Search Terms:

skipLibCheck is ignored
skipLibCheck not working

Code

N/A

Expected behavior:

TypeScript should ignore type errors in node_modules (or skip reporting them? I'm not sure exactly what skipLibCheck does).

Actual behavior:

When skipLibCheck is set to true, TS will still have type errors in packages in node_modules. It seems that this is the case if a package's types field in the package's tsconfig.json file points to a .ts file instead of a .d.ts file.

For example, in my project that consumes the lume package, there are type errors like these:

node_modules/lume/src/html/WithUpdate.ts:132:13 - error TS2784: 'get' and 'set' accessors cannot declare 'this' parameters.

132     get props(this: any): any {
                  ~~~~~~~~~

node_modules/lume/src/core/Utility.ts:5:10 - error TS7030: Not all code paths return a value.

5 function applyCSSLabel(value: any, label: any) {
           ~~~~~~~~~~~~~

As you can see the path in the errors are in node_modules. The lume package's types field points to its src/index.ts file, and hence all the types in that package are based on .ts files instead of .d.ts files.

Playground Link:

N/A


Maybe I misunderstand what skipLibCheck does. What should it do exactly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions