Open
Description
Bug Report
🔎 Search Terms
tsserver typescript langauge server loading intellisense status indefinite error forever asserts assertion function vscode conditional type
🕗 Version & Regression Information
- This changed between versions
4.7.4
and4.8.0-beta
and happens in all versions up to4.9.0-dev.20221015
⏯ Playground Link
Unfortunately, painstakingly copy-pasting all the types from the various packages into the playground doesn't allow me to reproduce the issue. So instead, I've created a minimal example repository that demonstrates the issue: https://github.com/Xunnamius/mre-typescript-issue-51188
💻 Code
import { visit, SKIP, type Visitor } from 'unist-util-visit';
import type { Content as MdastContent } from 'mdast';
function assertNonNullable<T>(
value: T,
err: string
): asserts value is NonNullable<T> {
if (value === null) {
throw new Error(err);
}
}
export function visitAndReveal<Tree extends MdastContent>(
tree: Tree,
visitor?: Visitor,
reverse?: boolean
) {
visit(
tree,
'hidden',
(node, index, parent) => {
// UNCOMMENTING THIS WILL KILL INTELLISENSE
// assertNonNullable(
// index,
// 'error while revealing hidden node: node index is missing'
// );
// UNCOMMENTING THIS WILL KILL INTELLISENSE
// assertNonNullable(
// parent,
// 'error while revealing hidden node: node parent is missing'
//);
return visitor?.(node, index, parent) ?? [SKIP, index];
},
reverse
);
}
🙁 Actual behavior
Tsserver and intellisense in vscode (latest version) hang when using a TypeScript version >=4.8.0-beta
. See video example below.
🙂 Expected behavior
Tsserver/intellisense does not hang in latest versions of vscode and TypeScript.