-
Notifications
You must be signed in to change notification settings - Fork 782
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
Proposal: Move TypeScript declaration file (.d.ts) to @types/hyperapp #876
Comments
@tetradice Sounds good to me! 👍 |
I'm totally for this as I'm not a Typescript user myself (and not particularly interested in becoming one). But I was wondering what to do about all the @hyperapp/* packages? If they are to be typed as well, how would they be handled? |
@zaceno Hmm, in that case, I think that |
@zaceno @jorgebucaran I've never tried to contribute to DefinitelyTyped, so I looked into it a little, but maybe the suggestion might not be possible. I've looked into it, and the type declarations for packages of the form $ npm install --save-dev @hyperapp/events @types/hyperapp__events This isn't intuitive, but it's like the type of DefinitelyTyped, so we might have to follow it. 🤔 If we want to set up to just install
|
@tetradice I see. What about |
@jorgebucaran Unfortunately it is difficult. As far as I know, TypeScript can import in principle only in two ways: (I would like a solution that I don't know) |
@tetradice Well, let's keep the type declarations in each repo then. |
To load a type definition from e.g. {
"compilerOptions": {
"typeRoots" : ["./node_modules/@types", "./node_modules/@hyperapp/types"]
}
} |
@diontools As you pointed out, it can be imported if the user specifies |
How about moving TypeScript declaration file (
.d.ts
) to@types/hyperapp
? (in DefinitelyTyped)As a result, this allows it to be supported by a third party instead of being officially supported in the future. In addition, the following command must be executed to install the declaration file.
If someone wants to update the declaration file, that person sends a Pull Request to DefinitelyTyped repository.
Background
In Hyperapp V1,
hyperapp.d.ts
was included in the officialhyperapp
package, and this file was applied just by executingnpm install hyperapp
. This is convenient for users, but from the viewpoint of the author (@jorgebucaran) and maintainers, it seems to have the following problem.Therefore, it may be better to separate the TypeScript type definition file from the official repository and support it on the DefinitelyTyped repository side. (Many other famous libraries such as jquery and react do so)
Disadvantage
The disadvantage of this scheme is that for TypeScript programmers, one more package needs to be installed. As @Swizz has commented before, this is cumbersome.
#518 (comment)
But I think the reduction in official maintenance costs is worth the cost.
The text was updated successfully, but these errors were encountered: