feat: ship TypeScript declaration files - #1837
Conversation
|
Thanks, this looks like a useful addition! Note however that the Travis-CI failed dramatically. Since appveyor succeeded, I assume this is an OS specific issue we should figure out. |
95252db to
611768a
Compare
|
@lukastaegert all green, issue was some import paths has wrong casing. |
dd927de to
80dc054
Compare
80dc054 to
7d26611
Compare
lukastaegert
left a comment
There was a problem hiding this comment.
This looks good, thanks a lot! I'll merge it so that it is part of the next release
| withNew: boolean, | ||
| args?: Expression[], | ||
| caller: TaggedTemplateExpression | CallExpression | NewExpression | Property | void | ||
| export interface CallCreateOptions { |
There was a problem hiding this comment.
I agree this is probably a better name 👍
| import Pattern from './Pattern'; | ||
| import Expression from './Expression'; | ||
| import Scope from '../Scopes/Scope'; | ||
| import Scope from '../scopes/Scope'; |
|
Awesome cheers 😁 |
|
As a TypeScript developer: thank you! 😄 Note that DefinitelyTyped has a manually authored type definition published as |
|
You are welcome :). I am aware of that, and I’ll take care of removing it
…On Tue, 09 Jan 2018 at 00:53, Mattias Buelens ***@***.***> wrote:
As a TypeScript developer: thank you! 😄
Note that DefinitelyTyped has a manually authored type definition
published as @types/rollup. When the next version of Rollup is released,
this type package should be removed
<https://github.com/DefinitelyTyped/DefinitelyTyped#removing-a-package>
in favor for Rollup's own types.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1837 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQv-Wv8IVDFNIO42pVqsmgCxpQz4uDESks5tIqpegaJpZM4RUHng>
.
|
|
This PR seems to be outputting a full individual file compile of Rollup into the dist folder, along with typings for each of the unbuilt files. Surely we should just be publishing one top-level rollup.d.ts here for the outward API? I'm not sure I follow the use case for having separate typings per development module too, will TypeScript really be able to match up the types from these individual files to the dist/rollup.js file? |
|
It seems the typings run through "dist/typings/src/node-entry" as the main file in Node and these are working ok here. The only issue is that it doesn't support the |
|
Well at the moment, Regarding the flatting of Regarding different |
|
Indeed, TypeScript doesn't have a way to output a single declaration file yet, see microsoft/TypeScript#4433. There are tools that try to do this (such as |
|
My other worry here is that for example the It could be worth considering manually maintaining the outward .d.ts API file, especially since the Rollup API is so encapsulated, almost all of the types here are internal. |
|
Interal types should be marked as such so that they are not outputted.
Personally I don’t agree to having the types not generated by typescript
when you are wrting your code in typescript, why should someone keep on
maintaning the definitions when they are created put of the box?
My recommandation would be to structure the project in a way to emit the
types that are really needed and mark internal stuff as indeed internals so
they are not emitted.
However, I think while most of the types are outputted, these still cannot
be consumed by the API users, these are just internal for typescript and
not for developers, if there is a type that you can access which one
shouldn’t please do let me know.
…On Tue, 09 Jan 2018 at 19:09, Guy Bedford ***@***.***> wrote:
My other worry here is that for example the InputOptions in the API here
are just a generic configuration object, so a lot of the type benefits
aren't actually there.
It could be worth considering manually maintaining the outward .d.ts API
file, especially since the Rollup API is so encapsulated, almost all of the
types here are internal.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1837 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQv-WtN74mLY-sunn3NDXYHzPjvpY3_cks5tI6tqgaJpZM4RUHng>
.
|
|
Re ‘InputOptions’ it doesn look like a configuration object and is correctly defined with the proper types. In general i shouldn’t be able to assign an invalid value to the InputOptions. InputOptions is actual one of those critical types to have. The main point of TypeScript or one of the them is to have as strongly typed as possible even for the consumers, and in reality to use the API it can become so easy that in some cases you don’t even need to check the documentation as it will be self explanatory by the types themselves. |
|
@alan-agius4 I'm referring to the generic options we take in https://github.com/rollup/rollup/blob/master/src/rollup/index.ts#L208. I didn't know it was possible to mark types as "internal" in TypeScript... how would we go about doing this? |
|
Basicilly for the internal usefully you use it when somethings needs to be
exported you still dont want it exposed.
More info about this can be found here —stripInternal.
https://www.typescriptlang.org/docs/handbook/compiler-options.html
Actually the strandard for that GenericObject that you highlighted is
usually called a Dictionary, and declared like such;
https://github.com/sketch7/ssv-core/blob/develop/src/collection.ts.
However, yeah that might be redundant unless its reused in multiple places.
Really don’t like the name of it now that I am looking at it!
…On Tue, 09 Jan 2018 at 20:16, Guy Bedford ***@***.***> wrote:
@alan-agius4 <https://github.com/alan-agius4> I'm referring to the
generic options we take in
https://github.com/rollup/rollup/blob/master/src/rollup/index.ts#L208.
I didn't know it was possible to mark types as "internal" in TypeScript...
how would we go about doing this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1837 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQv-WrW8x_C4xPWHGGBLWyAAr6hToLXiks5tI7sYgaJpZM4RUHng>
.
|
|
I’ll have a look tomorrow probably, Maybe’ll be able to clean up some of
the undeed / unwanted declarations.
…On Tue, 09 Jan 2018 at 20:44, Alan Agius ***@***.***> wrote:
Basicilly for the internal usefully you use it when somethings needs to be
exported you still dont want it exposed.
More info about this can be found here —stripInternal.
https://www.typescriptlang.org/docs/handbook/compiler-options.html
Actually the strandard for that GenericObject that you highlighted is
usually called a Dictionary, and declared like such;
https://github.com/sketch7/ssv-core/blob/develop/src/collection.ts.
However, yeah that might be redundant unless its reused in multiple places.
Really don’t like the name of it now that I am looking at it!
On Tue, 09 Jan 2018 at 20:16, Guy Bedford ***@***.***>
wrote:
> @alan-agius4 <https://github.com/alan-agius4> I'm referring to the
> generic options we take in
> https://github.com/rollup/rollup/blob/master/src/rollup/index.ts#L208.
>
> I didn't know it was possible to mark types as "internal" in
> TypeScript... how would we go about doing this?
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <#1837 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AQv-WrW8x_C4xPWHGGBLWyAAr6hToLXiks5tI7sYgaJpZM4RUHng>
> .
>
|
|
A dictionary seems to contain uniform information which is not the case here? Anyway the reason we are using a generic object is because
I think we should actually handle this differently in the future:
Anyway, I think there is no harm in keeping this as it is for now (though merging might have been a little premature...) and do incremental improvements. But we should not remove the DefinitelyTyped definitions just yet. |
Closes: #1836
Some code changes needed to be done as some interface needs to be exported.