All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
Transform
Promise
toJS.Promise
(by @nojaf) (GH-33) -
Transform
Uint8Array
toJS.Uint8Array
-
Optional argument of F# Method are prefixed with
?
instead of suffixing them withoption
-
Sanitize names coming from TypeScript by removing surrounding quotes (
"
,'
) -
String enums containing a
-
should be escaped with backtick (GH-44) -
String enums starting with a number should be escaped with backtick (GH-43)
-
Optional interface properties should be transform into
'T option
-
Don't indent module name when printing the F# code
-
When leaving
module
scope, indent the printer memory -
Don't crash when flattening a union
export type LatLngTuple = [number, number, number?]; export type LatLngExpression = string | LatLngTuple;
type LatLngTuple = float * float * float option type LatLngExpression = U2<string, LatLngTuple>
-
Prevent infite loop when a class has a reference to a union type which reference the class itself
export declare class MyClass { contains(otherBoundsOrLatLng: MyUnion | string): boolean; } export type MyUnion = MyClass | string;
[<AllowNullLiteral>] [<Interface>] type MyClass = abstract member contains: otherBoundsOrLatLng: U2<MyUnion, string> -> bool type MyUnion = U2<MyClass, string>
-
Add support for
MethodSignature
on interface (GH-28) -
Ignore
ExportAssignment
as we don't know what to do with it yet -
Add support for literal type alias (GH-45)
type Mode = "auto"; type Rank1 = 1; type Trusty = true; type Falsy = false; type PiValue = 3.14;
-
Add support for
ThisType
(GH-13) -
Add support for
FunctionType
when used as a typeexport interface MyObject { instance: () => this; log: (a : Boolean, b : number) => this; }
[<AllowNullLiteral>] type MyObject = abstract member instance: (unit -> MyObject) with get, set abstract member log: (bool -> float -> MyObject) with get, set
-
Add support for
TupleType
-
Add support for
TypeLiteral
type Animal = { name: string; }
[<AllowNullLiteral>] type Animal = abstract member name: string with get, set
-
Add support for
IntersectionType
interface ErrorHandling { success: boolean; error?: string; } interface ArtworksData { artworks: string[]; } type ArtworksResponse = ArtworksData & ErrorHandling;
[<AllowNullLiteral>] type ErrorHandling = abstract member success: bool with get, set abstract member error: string option with get, set [<AllowNullLiteral>] type ArtworksData = abstract member artworks: ResizeArray<string> with get, set [<AllowNullLiteral>] type ArtworksResponse = abstract member artworks: ResizeArray<string> with get, set abstract member success: bool with get, set abstract member error: string option with get, set
-
Add support for argument spread operator (GH-57)
-
Add support for
{ new (...args: any): any}
(ConstructSignaure
) (GH-59) -
Add support for
static member
on classes (GH-60)export class Class { static methodA(): void; static methodB(arg1 : string, arg2: string): void; }
[<AllowNullLiteral>] [<Interface>] type Class = static member inline methodA () = emitJsExpr () $$""" import { Class } from "module"; Class.methodA()""" static member inline methodB (arg1: string, arg2: string) = emitJsExpr (arg1, arg2) $$""" import { Class } from "module"; Class.methodB($0, $1)"""
-
Add support for more primitive
TypeQuery
(Any
,String
,Number
,Bool
,Any
,Unit
) -
Add support for
TypeQuery
on a class declaration -
Add support for
propertyDeclaration
on a class declarationdeclare class Fuse { public version: string }
[<AllowNullLiteral>] [<Interface>] type Fuse = abstract member version: string with get, set
Works also for static properties
declare class Fuse { public static version: string }
[<AllowNullLiteral>] [<Interface>] type Fuse = static member inline version with get () : string = emitJsExpr () $$""" import { Fuse } from "module"; Fuse.version""" and set (value: string) = emitJsExpr (value) $$""" import { Fuse } from "module"; Fuse.version = $0"""
-
Supports private static property
export declare class SettingsContainer { static #privateField; }
[<AllowNullLiteral>] [<Interface>] type SettingsContainer = static member inline private ``#privateField`` with get () : unit = emitJsExpr () $$""" import { SettingsContainer } from "module"; SettingsContainer.#privateField""" and set (value: unit) = emitJsExpr (value) $$""" import { SettingsContainer } from "module"; SettingsContainer.#privateField = $0"""
-
Add support for optional type
export type LatLngTuple = [number, number, number?];
type LatLngTuple = float * float * float option
-
Replace
Boolean
withbool
-
Map
Date
type toJS.Date
(GH-48) -
Decorate all interface with
[<Interface>]
attribute this is to ensure they are erased at runtime even if they only havestatic member
attached to them -
Private field are not exposed in the F# code, because F# interface doesn't support them
export declare class SettingsContainer { #privateField; }
[<AllowNullLiteral>] [<Interface>] type SettingsContainer = interface end
- Improve unsupported syntax error message to provide more context information (GH-26)
- Respect CLI arguments casing (GH-23)
- Rework a bit the logged information
- Support TypeReference with generics
- Basic CLI interface (help, version, options)
- Ability to write the output to a file (use
--out-file <file>
)
- Map
Date
type toDateTime
- Makes
typescript
part of the dependencies and not devDependencies
- Initial release