Generation of d.ts signatures for CST Parsers
See original GitHub issueSuch a feature would more easily enable consuming a CST exported by a parser Rather than requiring a transformation to a more well defined AST kind of structure.
Example:
export interface IJsonValueChildren {
StringLiteral?: IStringLiteral[]
}
export interface IJsonValue {
name: "JsonValue"
children: IJsonValueChildren
}
export interface JsonCstVisitor<I, O> {
visitJsonValue(ctx: IJsonValueChildren , param:I):O
}
Random Thoughts:
- Could this signature generation be extensible?
- e.g: to support customization of the CST by end users.
- Does TypeScript support defining the dimension of arrays?
-
StringLiteral?: IStringLiteral[1]
-
- It should be possible to distinguish between optional (“?”) and mandatory properties on the CST.
- If error recovery is enabled all children props are by definition optional.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Generation of d.ts signatures for CST Parsers #851 - GitHub
Random Thoughts: Could this signature generation be extensible? e.g: to support customization of the CST by end users. Does TypeScript support ...
Read more >Generation of TypeScript Declaration Files from JavaScript Code
This work presents dts-generate, a tool that generates. TypeScript declaration files for JavaScript libraries uploaded to the NPM registry.
Read more >Documentation - Creating .d.ts Files from .js files - TypeScript
With TypeScript 3.7, TypeScript added support for generating .d.ts files from JavaScript using JSDoc syntax. This set up means you can own the...
Read more >Type-Level GraphQL Parsing and Desirable Features for ...
The CAT option has the directive mean , which accepts no input. ... Moving parsing (for the sake of generating .d.ts) into the...
Read more >CST | Chevrotain
See the full CstNode type signature open in new window · Explore it by running the CST creation example in the online playground...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now part of the main chevrotain package.
The package to generate the signatures is available here:
Additional refactoring / docs is needed to export it from the root chevrotain package.