StaticScript icon indicating copy to clipboard operation
StaticScript copied to clipboard

Any plan to support union type?

Open Kingwl opened this issue 6 years ago • 2 comments

Or any idea?

I have some attempts in this, but I have some problems. (about type guard)

Kingwl avatar Nov 28 '18 11:11 Kingwl

Hey!

Maybe I didn't understand question:

I will store Object as plain structures when this will be possible and as V8::Value Related typechecking, this will be on frontend side (typescript as framework)

But, I only started, I need sometime to start implementing it :)

Thanks

ovr avatar Nov 29 '18 17:11 ovr

Sorry, maybe I didn’t make it clear.

for example:


interface Foo {
a: string
b: string
}

interface Bar {
b: string
c: string
}

type Baz = Foo | Bar

declare const a: Baz

a.b = "" // here

if union type is implemented as a plain struct where is the b field? (if you do not use the v8::object)

Kingwl avatar Nov 30 '18 02:11 Kingwl