Skip to content

Commit

Permalink
Fix import statement completions followed by interface declaration (#…
Browse files Browse the repository at this point in the history
…50350)

* Fix import statement completions followed by interface declaration

* Fix stuff

* Linty

* Fix when named imports is missing closing brace
  • Loading branch information
andrewbranch committed Sep 20, 2022
1 parent e002159 commit 938a69a
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Expand Up @@ -41414,7 +41414,7 @@ namespace ts {
}
else {
Debug.assert(node.kind !== SyntaxKind.VariableDeclaration);
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)) as ImportDeclaration | ImportEqualsDeclaration | undefined;
const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration));
const moduleSpecifier = (importDeclaration && tryGetModuleSpecifierFromDeclaration(importDeclaration)?.text) ?? "...";
const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName);
error(
Expand Down
3 changes: 3 additions & 0 deletions src/compiler/core.ts
Expand Up @@ -2371,6 +2371,9 @@ namespace ts {
return (arg: T) => f(arg) && g(arg);
}

export function or<P, R1 extends P, R2 extends P>(f1: (p1: P) => p1 is R1, f2: (p2: P) => p2 is R2): (p: P) => p is R1 | R2;
export function or<P, R1 extends P, R2 extends P, R3 extends P>(f1: (p1: P) => p1 is R1, f2: (p2: P) => p2 is R2, f3: (p3: P) => p3 is R3): (p: P) => p is R1 | R2 | R3;
export function or<T extends unknown[], U>(...fs: ((...args: T) => U)[]): (...args: T) => U;
export function or<T extends unknown[], U>(...fs: ((...args: T) => U)[]): (...args: T) => U {
return (...args) => {
let lastResult: U;
Expand Down

0 comments on commit 938a69a

Please sign in to comment.