Skip to content

v0.10.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 22 Jun 20:16
· 95 commits to main since this release
v0.10.0
248ea70
  • Automatically discriminate aliased structs in flat unions

    @bare-ts is now able to automatically add a discriminator field for
    aliased structs in flat union.

    The name of the discriminator field is tag.
    For now, it is not possible to flatten aliased structs with at least
    one field named tag.

    Thus, under the option --use-flat-union, the following BARE types:

    type X struct { ... }
    type Y struct { ... }
    type XY union { X | Y }
    

    translate to the following TypeScript types:

    export interface X { readonly tag: "X"; ... }
    export interface Y { readonly tag: "Y"; ... }
    export type XY = X | Y
  • Allow flat unions of anonymous structs

    @bare-ts now accepts flat unions of anonymous structs.
    It automatically uses the union tags to discriminate the structs.

    Under the option --use-flat-union, the following BARE types:

    type XY union { struct { ... } | struct { ... } }
    

    translate to the following TypeScript types:

    export type XY = { readonly tag: 0, ... } | { readonly tag: 1, ... }
  • Forbid flat unions of transitively aliased classes

    @bare-ts previously allowed flat unions of transitively aliased classes.
    It now rejects the following schema under the option --use-flat-union:

    type Named struct { name: str }
    type Person Named
    type Message union { Person }
    
  • Require Node 14.18.0 or above

    @bare-ts now requires Node 14.18.0 or above.
    This enables @bare-ts/tools to internally use node: prefixes
    for importing nodes' built-ins.