Détail du package

@typescript/native-preview

microsoft0Apache-2.07.0.0-dev.20250611.1

Preview CLI of the native TypeScript compiler port

TypeScript, Microsoft, compiler, language

readme

TypeScript (Native Preview)

This package provides a preview build of the native port of TypeScript. Not all features are implemented yet.

This package is intended for testing and experimentation. It will eventually be replaced by the official TypeScript package.

Usage

Use the tsgo command just like you would use tsc:

npx tsgo --help

Issues and Feedback

The native port of TypeScript is still in progress. We expect many gaps, but are seeking experimentation and feedback. If you have found differences that are not yet known, we encourage you to leave feedback on the issue tracker.

changelog

CHANGES.md lists intentional changes between the Strada (Typescript) and Corsa (Go) compilers.

Scanner

  1. Node positions use UTF8 offsets from the beginning of the file, not UTF16 offsets. Node positions in files with non-ASCII characters will be greater than before.

Parser

  1. Source files do not contain an EndOfFile token as their last child.
  2. Malformed ...T? at the end of a tuple now fails with a parse error instead of a grammar error.
  3. Malformed string ImportSpecifiers (import x as "OOPS" from "y") now contain the string's text instead of an empty identifier.
  4. Empty binding elements no longer have a separate kind for OmittedExpression. Instead they have Kind=BindingElement with a nil Initialiser, Name and DotDotDotToken.
  5. ShorthandPropertyAssignment no longer includes an EqualsToken as a child when it has an ObjectAssignmentInitializer.
  6. JSDoc nodes now include leading whitespace in their location.
  7. The parser always parses a JSDocText node for comments in JSDoc. string is no longer part of the type of comment.
  8. In cases where Strada did produce a JSDocText node, Corsa no longer (incorrectly) includes all leading and trailing whitespace/asterisks, as well as initial /**.
  9. JSDocMemberName is now parsed as QualifiedName. These two nodes previously only differed by type, and now QualifiedName has a much less restrictive type for its left child.

JSDoc types are parsed in normal type annotation position but show a grammar error. Corsa no longer parses the JSDoc types below, giving a parse error instead of a grammar error.

  1. No postfix T? and T! types. Prefix ?T and !T are still parsed and !T continues to have no semantics.
  2. No Closure function(string,string): void types.
  3. No JSDoc standalone ? type.
  4. No JSDoc module namepaths: module:folder/file.C

Corsa no longer parses the following JSDoc tags with a specific node type. They now parse as generic JSDocTag nodes.

  1. @class
  2. @throws
  3. @author
  4. @enum