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

Why not use declare module typings? #269

Open
pauldraper opened this issue Mar 18, 2024 · 6 comments
Open

Why not use declare module typings? #269

pauldraper opened this issue Mar 18, 2024 · 6 comments

Comments

@pauldraper
Copy link

Path mappings work, but are rarely used since every downstream TypeScript project also has to set them.

More typical is module declarations.

declare module "N/log" {
}

These are then added by one of:

  1. Installing under @types as a npm alias (or having the project in DefinitelyTyped to begin with)
  2. Adding typeRoots.
  3. Referencing the types via tripe slash /// <reference types="..." />

Note that module declarations is how Node.js typings work (@types/node).

@btonasse
Copy link

This might be worth a fork

@ShawnTalbert
Copy link
Contributor

I'd always be in favor of making these types easier for end users to adopt in their projects.

If either of you ( @btonasse, @pauldraper) have explored this in a fork, feel free to suggest a PR?

Have we previously considered adding this to DefinitelyTyped? If so, why isn't this there? If not, it's worth looking into.

@MrRob
Copy link
Collaborator

MrRob commented Oct 16, 2024

Sounds interesting, I don't know if it was ever considered, we'd have to ask @johnogle222

@johnogle222
Copy link
Contributor

I am far from qualified to comment on the best way to declare typescript definitions these days. There's no particular reason why this project is setup using the conventions that it is other than it worked for me at the time and others grew it from there. If there is a better way to structure it that makes the project easier to adopt and use then by all means don't let me get in the way :)

@btonasse
Copy link

Hi @ShawnTalbert I'm also far from a typescript expert, so I don't know if anything I did there is good practice, but I actually did create a fork: https://github.com/btonasse/suitescript-types

@pauldraper
Copy link
Author

pauldraper commented Oct 18, 2024

Re "best practice": The most user-friendly thing to do is to get types in https://github.com/DefinitelyTyped/DefinitelyTyped, as @types/suitescript.

Similar to @types/node https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node .

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

5 participants