Skip to content

chore: prevent null in heritage extends expressions #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jul 24, 2025

This is a temporary workaround to generate valid typescript. This solution is not completely correct, and is subject to future change.

Related to #40

This solution treats a pointer the same as without a pointer. The outcome is therefore a subset of the valid types, so we can expand the output type later, and it should be backwards compatible.

type A struct {
	Foo string
}

type B struct {
	*A
	Bar int
	Qux bool
}
interface A {
    Foo: string;
}

// Ideally 'extends A' would also accept 'A' to be `{}`.
// I was really hoping we could do something like 'extends A | {}', but alas we cannot
interface B extends A {
    Bar: number;
    Qux: boolean;
}

This is a temporary workaround to generate valid typescript. This
solution is not completely correct, and is subject to future change.
Copy link
Contributor

@toqueteos toqueteos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice touch doing the loop. I didn't consider pointers could be multiple level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants