|
| 1 | +/src/main.ts(1,23): error TS2306: File '/stub.d.ts' is not a module. |
| 2 | +/src/main.ts(2,29): error TS2306: File '/stub.d.ts' is not a module. |
| 3 | +/src/main.ts(3,26): error TS2306: File '/generated/component.svelte.d.ts' is not a module. |
| 4 | +/src/main.ts(4,26): error TS2306: File '/src/script.ts' is not a module. |
| 5 | + |
| 6 | + |
| 7 | +==== /tsconfig.json (0 errors) ==== |
| 8 | + { |
| 9 | + "compilerOptions": { |
| 10 | + "paths": { "x.svelte": ["./stub.d.ts"] }, |
| 11 | + "rootDirs": ["./src", "./generated"] |
| 12 | + }, |
| 13 | + "files": ["ambient.d.ts", "src/main.ts"] |
| 14 | + } |
| 15 | + |
| 16 | +==== /ambient.d.ts (0 errors) ==== |
| 17 | + declare module "*.svelte" { |
| 18 | + const value: number; |
| 19 | + export default value; |
| 20 | + } |
| 21 | + declare module "*.svelte" with { type: "text" } { |
| 22 | + const value: string; |
| 23 | + export default value; |
| 24 | + } |
| 25 | + declare module "*.js" { |
| 26 | + const value: number; |
| 27 | + export default value; |
| 28 | + } |
| 29 | + |
| 30 | +==== /src/main.ts (4 errors) ==== |
| 31 | + import fromPaths from "x.svelte"; |
| 32 | + ~~~~~~~~~~ |
| 33 | +!!! error TS2306: File '/stub.d.ts' is not a module. |
| 34 | + import emptyAttributes from "x.svelte" with {}; |
| 35 | + ~~~~~~~~~~ |
| 36 | +!!! error TS2306: File '/stub.d.ts' is not a module. |
| 37 | + import fromRootDirs from "./component.svelte"; |
| 38 | + ~~~~~~~~~~~~~~~~~~~~ |
| 39 | +!!! error TS2306: File '/generated/component.svelte.d.ts' is not a module. |
| 40 | + import fromRelative from "./script.js"; |
| 41 | + ~~~~~~~~~~~~~ |
| 42 | +!!! error TS2306: File '/src/script.ts' is not a module. |
| 43 | + const fromPathsValue: string = fromPaths; |
| 44 | + |
| 45 | + import text from "x.svelte" with { type: "text" }; |
| 46 | + const textValue: string = text; |
| 47 | + |
| 48 | + import missing from "./missing.svelte"; |
| 49 | + const missingValue: number = missing; |
| 50 | + |
| 51 | +==== /stub.d.ts (0 errors) ==== |
| 52 | + // A resolved script must not fall back to a pattern ambient module without attributes. |
| 53 | + |
| 54 | +==== /generated/component.svelte.d.ts (0 errors) ==== |
| 55 | + // A script resolved through rootDirs. |
| 56 | + |
| 57 | +==== /src/script.ts (0 errors) ==== |
| 58 | + // A script resolved through a relative import. |
| 59 | + |
0 commit comments