-
-
Notifications
You must be signed in to change notification settings - Fork 292
docs: Suggest to use global.ts
instead of global.d.ts
for better compatibility with skipLibCheck
#1814
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
Conversation
Declaration files (`.d.ts`) are for build output. Source files (`*.ts`) are for source code. Declaration files are not type checked when `skipLibCheck` is enabled. There are legimiate use cases, but typically they should not exist outside of `node_modules`. See vitejs/vite#19693
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@remcohaszing is attempting to deploy a commit to the next-intl Team on Vercel. A member of the Team first needs to authorize it. |
Hmm,
Do you have some more background or a reproduction where |
I decided to do a little write-up / playground to link to: https://github.com/remcohaszing/skiplibcheck I just started using |
That's interesting, thanks for writing this down! So if I understand correctly, with That's also the reason why in the troubleshooting section for type augmentation, there's an entry for:
I think if we get rid of the I mostly went with I need to leave for today but will have another look at this tomorrow, I'll be in touch!
That's awesome to hear! Definitely let me know if you have some feedback, I'm always really happy to hear from curious developers! 🤓 |
I agree! What should we call it? The types file? Augmentation file?
I understand. I don’t know who started this pattern, but it’s wide-spread. I’m trying to unnormalize it. It’s a pure coincidence I saw this while implementing
I love that you mention a solution for markdown/MDX! Also the way you use type augmentations. One thing I do miss coming from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had another look, and I think this is a good idea—many thanks for proposing it! 🙌
I agree! What should we call it? The types file? Augmentation file?
I just had a look through the docs and I think we don't have to give it a particular name—at least as far as the docs are concerned.
@@ -289,7 +289,7 @@ export const formats = { | |||
|
|||
Now, you can include the `formats` in your `AppConfig`: | |||
|
|||
```ts filename="global.d.ts" | |||
```ts filename="global.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further below, could you remove this bullet?
You’re using correct paths for all modules you’re importing into your global declaration file.
(this should no longer be necessary thanks to your proposed change)
Are you referring to message extraction here? Somewhat off-topic, I'm always really curious about what kind of strategy experienced developers like to use for structuring their messages. Do you have an opinion on this? |
Now that module augmentations are type checked, TypeScript will show an error for invalid module names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks a lot @remcohaszing! 🙌
global.ts
instead of global.d.ts
for better compatibility with skipLibCheck
Declaration files (
.d.ts
) are for build output. Source files (*.ts
) are for source code. Declaration files are not type checked whenskipLibCheck
is enabled. There are legimiate use cases, but typically they should not exist outside ofnode_modules
.See vitejs/vite#19693