Skip to content
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

Option to generate types instead of interfaces #1158

Open
jeffrey-ng opened this issue Jan 22, 2025 · 1 comment
Open

Option to generate types instead of interfaces #1158

jeffrey-ng opened this issue Jan 22, 2025 · 1 comment

Comments

@jeffrey-ng
Copy link

Is it possible to add an option to generate types instead of interfaces?

aka instead of

export interface Message {
  text: string;
}

we would generate

export type Message = {
  text: string;
}

Our specific use case is to conform with Jsonfiable
https://github.com/sindresorhus/type-fest/blob/main/source/jsonifiable.d.ts

@stephenh
Copy link
Owner

Huh; kind of a lazy ask, but are you sure interface Message { text: string } doesn't match Jsonfiable? I didn't think that interface Foo vs. type Foo really mattered to the TS type system.

Granted, we have a few asks for "types that are exactly JSON":

#1022

And the existing useJsonWireFormat flag.

I just did a test locally in one of our test files:

    let json: Jsonfiable = simple;

And it seems to work.

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

No branches or pull requests

2 participants