sjrd/scala-js-ts-importer

Feature: Optional field foo? should be translated to js.UndefOr

Opened this issue · 2 comments

TypeScript has foo? notation to indicate optional (can be null/undefined) type

Currently, scalajs-ts-importer converts foo?: T; into foo: T which can not accept js.undefined.


var state: Int = js.native

I think it should be converted to js.UndefOr[T]

sjrd commented

The link to the TypeScript documentation you gave is about optional parameters, but your issue talks about optional fields.

Sorry, updated the links.