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

Use type instead of interface #272

Open
ryanleecode opened this issue Apr 28, 2024 · 1 comment
Open

Use type instead of interface #272

ryanleecode opened this issue Apr 28, 2024 · 1 comment

Comments

@ryanleecode
Copy link

Proposed changes

Using interface for base types causes a lot of bullshit when it comes to generics trying to consume this type because of index signatures.

All the interface signatures should be converted to type

Context

https://www.totaltypescript.com/type-vs-interface-which-should-you-use

For example the current type signatues cause a lot of problems when trying to make it a deserialization JSON type

type JsonPrimitive = string | number | boolean | null | undefined | Date | symbol;
type JsonArray = Json[];
type JsonRecord<T> = {
    [Property in keyof T]: Json;
};
type Json<T = any> = JsonPrimitive | JsonArray | JsonRecord<T>;
@lukeocodes
Copy link
Contributor

@ryanleecode can you spell out exactly what it is that is not working?

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