mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-10-28 16:36:04 +08:00
Preserve TS2306 for resolved non-module files before wildcard fallback
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
This commit is contained in:
1 parent
7a274f5a15
commit
a77c8dfe5e
3 files changed
+10
-14
No files matched your search
@@ -15695,10 +15695,6 @@ func (c *Checker) resolveExternalModule(
|
||||
}
|
||||
return c.tryResolvePatternAmbientModule(c.getMergedSymbol(sourceFile.Symbol), moduleReference, importAttributesType)
|
||||
}
|
||||
patternAmbientModule := c.tryResolvePatternAmbientModule(nil /*resolvedSymbol*/, moduleReference, importAttributesType)
|
||||
if patternAmbientModule != nil {
|
||||
return patternAmbientModule
|
||||
}
|
||||
if errorNode != nil && moduleNotFoundError != nil && !isSideEffectImport(errorNode) {
|
||||
c.error(errorNode, diagnostics.File_0_is_not_a_module, resolvedModule.ResolvedFileName)
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/src/main.ts(2,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
/src/main.ts(5,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
/src/main.ts(1,20): error TS2306: File '/stub.d.ts' is not a module.
|
||||
/src/main.ts(4,22): error TS2306: File '/generated/relative.svelte.d.ts' is not a module.
|
||||
|
||||
|
||||
==== /tsconfig.json (0 errors) ====
|
||||
@@ -27,14 +27,14 @@
|
||||
|
||||
==== /src/main.ts (2 errors) ====
|
||||
import script from "script.svelte";
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2306: File '/stub.d.ts' is not a module.
|
||||
const scriptValue: string = script;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
import relative from "./relative.svelte";
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2306: File '/generated/relative.svelte.d.ts' is not a module.
|
||||
const relativeValue: string = relative;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
import resolved from "module.svelte";
|
||||
const resolvedValue: string = resolved;
|
||||
|
||||
+4
-4
@@ -13,18 +13,18 @@ declare module "*.svelte" {
|
||||
|
||||
=== /src/main.ts ===
|
||||
import script from "script.svelte";
|
||||
>script : number
|
||||
>script : any
|
||||
|
||||
const scriptValue: string = script;
|
||||
>scriptValue : string
|
||||
>script : number
|
||||
>script : any
|
||||
|
||||
import relative from "./relative.svelte";
|
||||
>relative : number
|
||||
>relative : any
|
||||
|
||||
const relativeValue: string = relative;
|
||||
>relativeValue : string
|
||||
>relative : number
|
||||
>relative : any
|
||||
|
||||
import resolved from "module.svelte";
|
||||
>resolved : string
|
||||
|
||||
Reference in new issue
Block a user