-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Description
Take this code block:
const Filter = createToken({
name: "Filter" as const,
pattern: new RegExp("filter", "i"),
})
const functionName = this.CONSUME(Filter);
return { type: functionName.tokenType.name };Considering the name of the TokenType interface is always string, the return type of this function is {type: string}.
Where the above snippet is simple/small, this creates overhead for larger grammars where better type information is wanted, and adds the burden of specifying more accurate types to the developer.
Ideally, the types are derived automatically, making the returntype of the MWE type: "Filter"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels