charto / cxsd

Streaming XSD parser and XML parser generator with TypeScript output
MIT License
111 stars 55 forks source link

Inheritence? #20

Closed walterdeboer closed 7 years ago

walterdeboer commented 7 years ago

So I have in my XSD two ComplexTypes that extend eachother and a third one that uses them. This results in:

interface _A {
}
export interface A extends _A { ... } ;

interface _B extends _A {
}
export interface B extends _B { ... } ;

interface _C {
 a: A;
}
export interface C extends _C { ... } ;

I would like interface B to extend interface A (instead of _A). When I use interface A in a third cass, I can't assing a B object!

const c = {
  a: B
} as C;

This wont work, since B isn't compatible with A! Or am I missing something?

Or should _C have been generated as:

interface _C {
  a: _A;
}
walterdeboer commented 7 years ago

It looks like Typescript is more forgiving than I am...