Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Don't import from typescript source files #125

Merged
merged 1 commit into from Aug 21, 2021

Conversation

shadow-light
Copy link
Contributor

@shadow-light shadow-light commented Aug 20, 2021

Importing from typescript source files distributed with a module causes user projects to type check those source files using the tsconfig of the user project rather than that of the module, with stricter settings raising errors that are not actually errors but simply stricter type check settings.

See microsoft/TypeScript#40426

Importing from typescript source files distributed with a module causes user projects to type check those source files using the tsconfig of the user project rather than that of the module, with stricter settings raising errors that would otherwise go unnoticed.

See microsoft/TypeScript#40426
@shadow-light
Copy link
Contributor Author

The result of this issue is that when checking my project's types, it throws these errors simply because it followed the import paths to the module's typescript source. There is currently no way to silence these errors as tsconfig exclude and other settings have no effect.

app/node_modules/@vue/component-compiler-utils/lib/compileTemplate.ts:109:32 - error TS4111: Property 'NODE_ENV' comes from an index signature, so it must be accessed with ['NODE_ENV'].

109     isProduction = process.env.NODE_ENV === 'production',
                                   ~~~~~~~~

app/node_modules/@vue/component-compiler-utils/lib/compileTemplate.ts:182:15 - error TS2571: Object is of type 'unknown'.

182           if (e.code === 'MODULE_NOT_FOUND') {
                  ~

app/node_modules/@vue/component-compiler-utils/lib/templateCompilerModules/srcset.ts:37:15 - error TS2322: Type '{ require: string; descriptor: string | undefined; }[]' is not assignable to type 'ImageCandidate[]'.
  Type '{ require: string; descriptor: string | undefined; }' is not assignable to type 'ImageCandidate'.
    Types of property 'descriptor' are incompatible.
      Type 'string | undefined' is not assignable to type 'string'.
        Type 'undefined' is not assignable to type 'string'.

37         const imageCandidates: ImageCandidate[] = value
                 ~~~~~~~~~~~~~~~

app/node_modules/@vue/component-compiler-utils/lib/templateCompilerModules/srcset.ts:48:37 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.

48               require: urlToRequire(url, transformAssetUrlsOptions),
                                       ~~~


@underfin underfin merged commit d05f74d into underfin:master Aug 21, 2021
@shadow-light shadow-light deleted the patch-1 branch August 21, 2021 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants