1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
Description: TypeScript 5.0 compatibility fixes
- Replace @import JSDoc with @typedef (TS 5.5+ feature)
- Use preserveSymlinks to avoid resolving system util polyfill
- Exclude test/ and xo.config* from compilation
- Replace @ts-expect-error with @ts-ignore
- Fix JSDoc template type for isURL function
Author: Jérémy Lal <kapouer@melix.org>
Forwarded: not-needed
--- a/lib/resolve.js
+++ b/lib/resolve.js
@@ -3,9 +3,9 @@
// Last checked on: Apr 29, 2024.
/**
- * @import {Stats} from 'node:fs'
- * @import {ErrnoException} from './errors.js'
- * @import {PackageConfig} from './package-json-reader.js'
+ * @typedef {import('node:fs').Stats} Stats
+ * @typedef {import('./errors.js').ErrnoException} ErrnoException
+ * @typedef {import('./package-json-reader.js').PackageConfig} PackageConfig
*/
import assert from 'node:assert'
@@ -66,7 +66,7 @@
base,
isTarget
) {
- // @ts-expect-error: apparently it does exist, TS.
+ // @ts-ignore: apparently it does exist, TS.
if (process.noDeprecation) {
return
}
@@ -97,7 +97,7 @@
* @returns {void}
*/
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
- // @ts-expect-error: apparently it does exist, TS.
+ // @ts-ignore: apparently it does exist, TS.
if (process.noDeprecation) {
return
}
@@ -674,7 +674,7 @@
* @param {URL} base
*/
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
- // @ts-expect-error: apparently it does exist, TS.
+ // @ts-ignore: apparently it does exist, TS.
if (process.noDeprecation) {
return
}
@@ -1188,8 +1188,7 @@
* We use `href` and `protocol` as they are the only properties that are
* easy to retrieve and calculate due to the lazy nature of the getters.
*
- * @template {unknown} Value
- * @param {Value} self
+ * @param {any} self
* @returns {Value is URL}
*/
function isURL(self) {
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,8 +9,9 @@
"lib": ["es2022"],
"module": "node16",
"strict": true,
- "target": "es2022"
+ "target": "es2022",
+ "preserveSymlinks": true
},
- "exclude": ["coverage/", "node_modules/"],
+ "exclude": ["coverage/", "node_modules/", "test/", "xo.config*"],
"include": ["**/*.js"]
}
--- a/lib/package-json-reader.js
+++ b/lib/package-json-reader.js
@@ -5,7 +5,7 @@
// Also: no need to cache, we do that in resolve already.
/**
- * @import {ErrnoException} from './errors.js'
+ * @typedef {import('./errors.js').ErrnoException} ErrnoException
*
* @typedef {'commonjs' | 'module' | 'none'} PackageType
*
|