TypeScriptAST icon indicating copy to clipboard operation
TypeScriptAST copied to clipboard

Parser cannot handle 'readonly' modifier on property signature

Open RalfKoban opened this issue 6 years ago • 1 comments

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.

RalfKoban avatar Dec 10 '19 15:12 RalfKoban

Hi. This is old project for TypeScript, which is developing so fast. My main task was to make parser for JavaScript to AST. I think now is not the best option for parsing TypeScript. Now it's not easy to upgrade to the current TypeScript. It's time to rewrite TypeScriptAST. Microsoft showed us how to do it in System.Text.Json for .NET Core 3.0: "Provide high-performance JSON APIs. We needed a new set of JSON APIs that are highly tuned for performance by using Span<T>" https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-apis/ https://github.com/dotnet/runtime/blob/master/src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs

ToCSharp avatar Dec 11 '19 06:12 ToCSharp