You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/problems/NoResolution.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Import failed to resolve to type declarations or JavaScript files.
6
6
7
7
This problem indicates that TypeScript can’t find any file with a supported file extension (`.js`, `.mjs`, `.cjs`, `.jsx`, `.json`, `.ts`, `.mts`, `.cts`, `.tsx`) by following its own resolution algorithm, or a modified version of its resolution algorithm that ignores type declaration (`.d.ts`, `.d.mts`, `.d.cts`, `.d.*.ts`) files (which allows it to find JS files it would otherwise ignore).
8
8
9
-
## Consequnces
9
+
## Consequences
10
10
11
11
* Consumers will see TypeScript errors on imports/requires.
12
12
* If the diagnosis is accurate, a runtime/bundle-time error will occur.
@@ -15,7 +15,7 @@ This problem indicates that TypeScript can’t find any file with a supported fi
15
15
16
16
### False positive: unsupported file extension
17
17
18
-
TypeScript doesn’t record non-JS/TS files as resolution results, and its API can’t be used to distinguish between a result with an unuspported file extension and a non-existent file. If a package.json subpath exposes a non-JS asset like a `.css` file, designed to be processed by a bundler or runtime extension, this will show up as a failed resolution, when it might be more accurately described as an [untyped resolution](./UntypedResolution.md) of an unknown file type.
18
+
TypeScript doesn’t record non-JS/TS files as resolution results, and its API can’t be used to distinguish between a result with an unsupported file extension and a non-existent file. If a package.json subpath exposes a non-JS asset like a `.css` file, designed to be processed by a bundler or runtime extension, this will show up as a failed resolution, when it might be more accurately described as an [untyped resolution](./UntypedResolution.md) of an unknown file type.
19
19
20
20
If the asset is intended to be imported as a side-effect import (`import "pkg/styles.css"`), this problem can safely be ignored.
21
21
@@ -36,4 +36,4 @@ When this problem occurs for the `node10` resolution option but not any others,
36
36
37
37
In this example, an import of `"pkg/subpath"` can be used in Node 12+ and modern bundlers, but would fail to resolve in Node 10. Accordingly, TypeScript’s `--moduleResolution node10` (also confusingly known as `node`, because history) does not resolve `"exports"` either.
38
38
39
-
While few libraries care about supporting a long-past EOL version of Node, maintainers of very popular libraries should be aware that many TypeScript users are still using `--moduleResolution node`. If they aren’t literally using Node 10, they really should move away from it, but sometimes migrating can be difficult because it introduces new errors caused by _incorrect dependency typings_—the problem this tool was made to diagnose. Popular libraries often choose to adopt a strategy that allows `--moduleResolution node10` to work even without `"exports"` support. https://github.com/andrewbranch/example-subpath-exports-ts-compat demonstrates several such strategies.
39
+
While few libraries care about supporting a long-past EOL version of Node, maintainers of very popular libraries should be aware that many TypeScript users are still using `--moduleResolution node`. If they aren’t literally using Node 10, they really should move away from it, but sometimes migrating can be difficult because it introduces new errors caused by _incorrect dependency typings_—the problem this tool was made to diagnose. Popular libraries often choose to adopt a strategy that allows `--moduleResolution node10` to work even without `"exports"` support. https://github.com/andrewbranch/example-subpath-exports-ts-compat demonstrates several such strategies.
0 commit comments