TypeStrong / TypeStrong/ts-loader

ts-loader inconsistent with ts compiler

Open
#1,629 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.5k
Forks
439
Avg merge
17h 17m
Merged PRs (30d)
2

Description

In my project I get some errors with the TS compiler (see code below)
The strange thing is I don't see/get the errors with Webpack/ts-loader.
All other errors are noticed correctly.

Any solution for this?

PS C:\danielm\git\gx\gitlab-projects\engatta\main\engatta-web> yarn tsc 
../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-react-npm-18.2.14-4d72cc1c1d-8c0.zip/node_modules/@types/react/ts5.0/global.d.ts:158:11 - error TS2451: Cannot redeclare block-scoped variable 'TrustedHTML'.

158 interface TrustedHTML { }
              ~~~~~~~~~~~

  ../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-trusted-types-npm-2.0.2-035cb17c5e-8c0.zip/node_modules/@types/trusted-types/index.d.ts:14:11
    14     const TrustedHTML: typeof lib.TrustedHTML;
                 ~~~~~~~~~~~
    'TrustedHTML' was also declared here.
  ../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-trusted-types-npm-2.0.2-035cb17c5e-8c0.zip/node_modules/@types/trusted-types/index.d.ts:15:10
    15     type TrustedHTML = lib.TrustedHTML;
                ~~~~~~~~~~~
    and here.

../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-trusted-types-npm-2.0.2-035cb17c5e-8c0.zip/node_modules/@types/trusted-types/index.d.ts:14:11 - error TS2451: Cannot redeclare block-scoped variable 'TrustedHTML'.

14     const TrustedHTML: typeof lib.TrustedHTML;
             ~~~~~~~~~~~

  ../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-react-npm-18.2.14-4d72cc1c1d-8c0.zip/node_modules/@types/react/ts5.0/global.d.ts:158:11
    158 interface TrustedHTML { }
                  ~~~~~~~~~~~
    'TrustedHTML' was also declared here.

../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-trusted-types-npm-2.0.2-035cb17c5e-8c0.zip/node_modules/@types/trusted-types/index.d.ts:15:10 - error TS2451: Cannot redeclare block-scoped variable 'TrustedHTML'.

15     type TrustedHTML = lib.TrustedHTML;
            ~~~~~~~~~~~

  ../../../../../../../Users/danielm/AppData/Local/Yarn/Berry/cache/@types-react-npm-18.2.14-4d72cc1c1d-8c0.zip/node_modules/@types/react/ts5.0/global.d.ts:158:11
    158 interface TrustedHTML { }
                  ~~~~~~~~~~~
    'TrustedHTML' was also declared here.


Found 3 errors.
Expected Behaviour

All errors logged/visible

Actual Behaviour

Some (TS2451) errors are ignored or maybe not fatal?

Steps to Reproduce the Problem
Location of a Minimal Repository that Demonstrates the Issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the TypeScript compiler invocation with the webpack/ts-loader configuration described in the issue, focusing on the TrustedHTML declarations in @types/react/ts5.0/global.d.ts and @types/trusted-types/index.d.ts. Reproduce the reported TS2451 errors and determine why tsc reports them while ts-loader does not; done means the same errors are surfaced consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.