v0.10.0
Pre-release-
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 namedtag.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 usenode:prefixes
for importing nodes' built-ins.