Skip to content

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 18 Oct 02:06
· 181 commits to main since this release
Immutable release. Only release title and notes can be modified.
  • breaking feat: parse_<lang>, parse_<lang>_json and format_<lang> return a result
    instead of throwing, as strip_typescript does: {ok: true, ast | json | code} or
    {ok: false, error}. error is a plain object shaped like an AST node —
    {kind, message, frame, start, end, loc}, message the one-line summary and frame the
    excerpt and caret — with kind: 'parse' for a syntax error and 'refused' for
    format_svelte's one refusal (a lone CR in an in-tag // comment). Argument errors and
    positionless engine failures (the size cap, a trap) still throw. TsvSyntaxError is replaced
    by TsvParseError, and every error type extends TsvError
  • feat: type stripping — strip_typescript(source, options?) in @fuzdev/tsv-wasm and
    @fuzdev/tsv, and tsv strip in both CLIs, turn TypeScript into JS by blanking every type
    to whitespace, so every line and column stays where it was. TypeScript that blanking cannot
    erase (enum, a value namespace, parameter properties, import =, export =, <T>x —
    what erasableSyntaxOnly rejects — and an as / satisfies whose blanking would regroup
    its expression) is refused rather than transformed, returned as an error, not thrown. Like
    format, an unnamed goal reads a module first and retries as a script, and a .mts path is
    always a module; tsv strip takes .ts/.mts/.cts paths (exit 0 stripped, 1 refused,
    2 an error). The format-only and parse-only packages do not carry it. See docs/strip.md
  • feat: a TSMethodSignature carries readonly: true when written (tsc's parser accepts it;
    acorn-typescript rejects it)
  • breaking fix: code that parsed at 0.6.0 and now rejects, as tsc or Svelte does — a bare
    type assertion as an assignment target (a as T = 1, <T>a += 1; parenthesized it still
    parses), and a hashbang at the start of a Svelte <script> or template expression
  • fix: a type argument list followed by <, or by +/- on the next line, parses as tsc
    reads it (f<T><U>(x) is a comparison)
  • fix: a prefix operator over a postfix update no longer continues into a call on the next
    line (a = !b++ then (z) => z is two statements)