-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
create a packages/types folder for all d.ts files #23
Comments
Why would you want to declare your own types and share it across the monorepo? |
Typically you can avoid such scenarios by just putting these declarations where they are used and typescript would just pick it up when the file is imported, see here for example: https://github.com/ixahmedxi/orbitkit/blob/main/packages/auth/src/lucia.ts |
By creating a dedicated types package, you imply that you want to share the same types across all apps and packages. Conceptually that wouldn't be the best practice as you likely use packages differently in different apps. Take a package like Auth.js which relies on a types declaration file ( For example, in your front-end app, you might want to include an avatar picture and points collected and in your admin dashboard a scope of privileges for what a user can access. That means that for your front-end app, your declaration file should look like this: declare module "next-auth" {
interface User {
avatar: string
points: number
}
} whereas in your admin dashboard app, it should look like this: declare module "next-auth" {
interface User {
privileges: {
read: boolean
write: boolean
}
}
} |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: