fix(core): find imports in export type statements (#13921)

This commit is contained in:
Spencer 2022-12-30 12:43:04 -06:00 committed by GitHub
parent c783ac5e9a
commit d5c93bfa39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -47,6 +47,7 @@ import('./module.ts')`;
} from './a';
export { B } from './b';
export type { B } from './b';
export { C as D } from './c';
@ -58,6 +59,7 @@ export {
A
} from './a'
export { B } from './b'
export type { B } from './b'
export { C as D } from './c'`;
expect(stripSourceCode(scanner, input)).toEqual(expected);

View File

@ -1,6 +1,6 @@
import type { Scanner } from 'typescript';
let SyntaxKind;
let SyntaxKind: typeof import('typescript').SyntaxKind;
export function stripSourceCode(scanner: Scanner, contents: string): string {
if (!SyntaxKind) {
SyntaxKind = require('typescript').SyntaxKind;
@ -90,7 +90,8 @@ export function stripSourceCode(scanner: Scanner, contents: string): string {
}
if (
token === SyntaxKind.OpenBraceToken ||
token === SyntaxKind.AsteriskToken
token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.TypeKeyword
) {
start = potentialStart;
}