tocsharp / typescriptast Goto Github PK
View Code? Open in Web Editor NEW.NET port of Microsoft's TypeScript parser for simple AST manipulation
License: Apache License 2.0
.NET port of Microsoft's TypeScript parser for simple AST manipulation
License: Apache License 2.0
Hi,
I'd like to parse something like
export default { .... }
but how can I do it?
None of the below assignments give me that root object with all definitions within the curly braces.
rootNode = ast.OfKind(SyntaxKind.ExportAssignment).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.ExportDeclaration).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.NamedExports).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.ExportKeyword).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.ExportSpecifier).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.DefaultClause).FirstOrDefault();
rootNode = ast.OfKind(SyntaxKind.DefaultKeyword).FirstOrDefault();
Hi there,
I got this System.InvalidCastException Cannot cast 'Zu.TypeScript.TsTypes.NamedImports' to 'Zu.TypeScript.TsTypes.INamedImportBindings'
when i try to parse the following code:
import { Component, HostBinding } from '@angular/core';
Thanks
Hello, I came across an implementation that was far away from what I was expecting while using the ChangeNode()
method.
If the replacement string provided equals the current node's string representation, the method throws an exception with message "Same value".
I'm convinced that one would expect a no-op in that particular case, and that this implementation is very unnatural, at the very least.
Hello! Thank you for interesting project.
It's very interesting to compare performance of your parser and typescript.
Please, add simple perf test
When the following code:
/**
* Property-based callback for X event
* @param payload: the x payload payload
*/
@Input() public onX: (payload: XPayload) => void;
is navigated to via TypeScriptAST, the property's JsDoc contains a single entry. That entry's Comment property is null. I can't find any way to get the actual comment text without using property.GetTextWithComments()
and manually parsing it.
Similarly, the parameter tag's comment is also not set - it is an empty string.
When parsing the file https://github.com/microsoft/TypeScript/blob/master/scripts/types/ambient.d.ts
, the parser cannot handle the situation properly that there is a readonly
modifier on a property signature.
Snippet:
namespace File {
export interface VinylOptions<T extends Contents = Contents> {
cwd?: string;
base?: string;
path?: string;
history?: readonly string[];
Subsequent Property signatures aren't reported anymore. Instead, expressions are reported.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.