Skip to content

Commit 5443048

Browse files
committed
In ts, introduce skipLibCheck (and sob)
Unlike a couple commits back, where I removed something because we want to avoid others copying it, here we end up *needing* to add it because there is not presently a story for how to handle `@types` declarations which are in the position `console-ui` is currently: - The consuming app/library is using `Node16` resolution, but does not have `"type": "module"` set, so TS interprets any unspecified module as being CJS. - The `@types` package itself depends on *another* package which is set to operate as ESM. Here, `console-ui`'s types point to `inquirer`'s types, which are set as ESM. In this situation, the direct dependency gets interpreted as CJS, and this produces an error, because it is CJS using `import` statements and TS complains that since it will be run as `require()` in CJS, you should switch to using dynamic import. But: it's a `.d.ts` file! We *cannot* use dynamic import there! Net, there is no current workaround for this that I have found; I have raised it in the TS Discord, and we will want to come up with a better solution (in this case: probably just by converting `console-ui` to publish a dual-package mode package *and* publish its own types). And in the meantime... we will ship this with `skipLibCheck`. :sigh:
1 parent 80f239f commit 5443048

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ts/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@
2121
]
2222
},
2323
"esModuleInterop": true,
24+
// We *really* don't want this on, but our hand is forced somewhat at the
25+
// moment: the types for `console-ui` are correct for consuming `inquirer`
26+
// in the pre-Node16 world, but
27+
"skipLibCheck": true
2428
}
2529
}

0 commit comments

Comments
 (0)