fix(core): find imports in export type statements (#13921)
This commit is contained in:
parent
c783ac5e9a
commit
d5c93bfa39
@ -47,6 +47,7 @@ import('./module.ts')`;
|
|||||||
} from './a';
|
} from './a';
|
||||||
|
|
||||||
export { B } from './b';
|
export { B } from './b';
|
||||||
|
export type { B } from './b';
|
||||||
|
|
||||||
export { C as D } from './c';
|
export { C as D } from './c';
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ export {
|
|||||||
A
|
A
|
||||||
} from './a'
|
} from './a'
|
||||||
export { B } from './b'
|
export { B } from './b'
|
||||||
|
export type { B } from './b'
|
||||||
export { C as D } from './c'`;
|
export { C as D } from './c'`;
|
||||||
|
|
||||||
expect(stripSourceCode(scanner, input)).toEqual(expected);
|
expect(stripSourceCode(scanner, input)).toEqual(expected);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { Scanner } from 'typescript';
|
import type { Scanner } from 'typescript';
|
||||||
|
|
||||||
let SyntaxKind;
|
let SyntaxKind: typeof import('typescript').SyntaxKind;
|
||||||
export function stripSourceCode(scanner: Scanner, contents: string): string {
|
export function stripSourceCode(scanner: Scanner, contents: string): string {
|
||||||
if (!SyntaxKind) {
|
if (!SyntaxKind) {
|
||||||
SyntaxKind = require('typescript').SyntaxKind;
|
SyntaxKind = require('typescript').SyntaxKind;
|
||||||
@ -90,7 +90,8 @@ export function stripSourceCode(scanner: Scanner, contents: string): string {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
token === SyntaxKind.OpenBraceToken ||
|
token === SyntaxKind.OpenBraceToken ||
|
||||||
token === SyntaxKind.AsteriskToken
|
token === SyntaxKind.AsteriskToken ||
|
||||||
|
token === SyntaxKind.TypeKeyword
|
||||||
) {
|
) {
|
||||||
start = potentialStart;
|
start = potentialStart;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user