-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
2.9.2 have broken my build process. After an investigation I found strange thing. There is a code which worked in previous version:
import { createToken, Lexer, IToken } from 'chevrotain';
export const WhiteSpace = createToken({
name: 'WhiteSpace',
pattern: /[ \t]+/,
line_breaks: false
});
...
Now it produces incorrect type definition:
import { Lexer, IToken } from 'chevrotain';
export declare const WhiteSpace: import("../../../../../../Golden/NS/lib/gdmn-nlp/node_modules/chevrotain").TokenType;
When I specify type of constant directly all works well:
import { createToken, Lexer, IToken, TokenType } from 'chevrotain';
export const WhiteSpace: TokenType = createToken({
name: 'WhiteSpace',
pattern: /[ \t]+/,
line_breaks: false
});
results into correct type definition:
import { Lexer, IToken, TokenType } from 'chevrotain';
export declare const WhiteSpace: TokenType;
The function CreateToken declared as:
export declare function createToken(config: ITokenConfig): TokenType
So, in the example above TS must know about type of constant and use type TokenType from library chevrotain instead of disk file.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created