valtyr/prisma-kysely

Feature Request: Interfaces instead of types

Closed this issue · 3 comments

Hello, I really like this project but I prefer to use interfaces instead of types. Is it possible to add an option for this?

Hey there @alex289, thank you for the interest. I'm wondering about your real life use-case for interfaces instead of types. The reason I chose types is that they don't display the same implicit (and possibly dangerous) declaration merging behavior that interfaces do. Is this just a matter of aesthetics or is there some feature of interfaces that you're actually missing here?

By the way, Matt Pocock (legend) wrote a nice blog post about this if you're interested: https://www.totaltypescript.com/type-vs-interface-which-should-you-use

Hey @valtyr, thanks for your answer. It's just for the aesthetic here. I'm using the create-t3-app where the linter is configured to prefer interfaces.

Thats a great article. I get the reason why he recommends types over interfaces but the TS team still recommends interfaces which must have some reason.

It's not a problem to use types so if this feature is too complex or not worth to implement thats fine.

I think I would prefer not having two different types for this, if it's only for aesthetic reasons. I would instead refer to issue #61 where we're planning to support prepending text to the generated file. This could include an /* eslint-disable */ statement for example. You could also tell eslint to ignore the generated file using a .eslintignore file. There's probably no reason to have your linter check generated code, since it's not code you edit directly.