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

Add TypeScript typings for SemanticReleaseError #92

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add TypeScript typings for SemanticReleaseError #92

wants to merge 6 commits into from

Conversation

pathurs
Copy link

@pathurs pathurs commented Nov 10, 2018

Add TypeScript typings for the class SemanticReleaseError.

This will allow TypeScript developers to import the Error with proper typings and intellisense.

Child of semantic-release/semantic-release#952
Connected to semantic-release/semantic-release#952

@pvdlg
Copy link
Member

pvdlg commented Nov 12, 2018

Can you provide some context? There is no description in your PR...
Is it related to semantic-release/semantic-release#952?
Have you talk with @mattyclarkson who work of the Typescript typing?

Copy link

@mattyclarkson mattyclarkson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add typings to the package.json so tsc can actually find these.

index.d.ts Outdated Show resolved Hide resolved
@mattyclarkson
Copy link

I've been insanely busy, so haven't circled around on this yet. These typings look sensible.

@pvdlg
Copy link
Member

pvdlg commented Nov 12, 2018

btw, @mattyclarkson is there a way to put all the typing in the same file in the main repo? Or is it necessary/better to have the typing for the error in this repo?

@pathurs
Copy link
Author

pathurs commented Nov 12, 2018

Sorry, I didn't realise this PR had been created, I'll fix this up soon.

@pathurs pathurs changed the title Create index.d.ts Add TypeScript typings for SemanticReleaseError Nov 12, 2018
@pathurs
Copy link
Author

pathurs commented Nov 12, 2018

@mattyclarkson This should be ready, I hope I didn't miss anything.

@mattyclarkson
Copy link

is there a way to put all the typing in the same file in the main repo?
Or is it necessary/better to have the typing for the error in this repo?

Possibly, but it would probably require extra configuration of the TypeScript compiler options. The standard way is to either keep the typings next to the code and specify the typings key in the package.json, or upload the typings to DefinitelyTyped and the compiler will look it up under @types NPM namespace.

I would say this it the most ergonomic way to do the typings; they are near the corresponding JavaScript code so can easily be updated and do not require any extra packages to be installed when using the package in a TypeScript project.

@pathurs
Copy link
Author

pathurs commented Nov 13, 2018

@mattyclarkson You could create a package, say @semantic-release/typings, that has all typings as sub folders like @semantic-release/typings/error for this package.

To which either you require the developer to install that library, or each of your libraries target the typings library with the typings property, and include the typings library as optional peer dependency in NPM.

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
@mattyclarkson
Copy link

@pathurs yup you could do that. If we're planning to have the typings separate to the JavaScript project it might make more sense to just submit them to @types?

@pathurs
Copy link
Author

pathurs commented Nov 13, 2018

@mattyclarkson I dislike DefinitelyTyped because it's harder for impulse volunteers to improve or include additions, however, it is definitely the preferred way.

@mattyclarkson
Copy link

@pathurs I also dislike DefinitelyTyped and separate typing packages. I find that they get out of sync and confusing for beginners to submit changes. I find that packages that have typings included in the project usually have a better quality experience.

@mattyclarkson
Copy link

@pvdlg this is good to go when you have time to swing by.

@pvdlg
Copy link
Member

pvdlg commented Nov 13, 2018

Ok, let's wait for the PR in the main semantic-release package to merge this one.

@YannickFricke
Copy link

@pvdlg Any news on this?

TypeScript is throwing errors for not finding the type definitions

@DanielHabenicht
Copy link

DanielHabenicht commented Sep 12, 2019

Ok, let's wait for the PR in the main semantic-release package to merge this one.

@pvdlg Which PR do you mean?

@pvdlg
Copy link
Member

pvdlg commented Nov 21, 2019

One that does't exists yet. No point in merging this PR until we have type in the core of semantic-release.

@123FLO321
Copy link

Any news on merging this PR?
I could really use this in my semantic-release plugin.

I don't see a reason to wait for the main semantic-release repo to have typings (they are avilable via DefinitelyTyped) since this package is separated.

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

Successfully merging this pull request may close these issues.

None yet

6 participants