Can we export all types from the package?
See original GitHub issueTitle says it all. There are types like RichTextItemResponse
and BlockObjectResponse
that would be useful to have so we could create utils in our integrations that perform type checking
Issue Analytics
- State:
- Created a year ago
- Reactions:27
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to export types in a TypeScript npm module
Without declaration files you can develop a package in TypeScript, compile it and expose it to other users as JavaScript code.
Read more >export type * from 'somewhere' #48508 - GitHub
Just like export * from 'foo' , we should be able to export type * from 'foo' to re-export all types (and only...
Read more >Documentation - Modules - TypeScript
Any declaration (such as a variable, function, class, type alias, or interface) can be exported by adding the export keyword. StringValidator.ts. ts. export ......
Read more >Package exports - webpack
The exports field in the package.json of a package allows to declare which module should be used when using module requests like import...
Read more >How to export a Type in TypeScript | bobbyhadz
Use a named export to export a type in TypeScript, e.g. export type Person = {} . The exported type can be imported...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This would also help me a lot. I’ve currently copied the
api-endpoints.ts
file to my project and exported all types, and it’s made type checking a much more pleasant process.Another related suggestion is to use types for all objects, rather than embedding objects. For example, instead of this:
Do this:
This way, if I’ve done the checking and am confident I’m working with a paragraph, then I can take advantage of the types this library is generating. Otherwise, I’m getting almost no benefit from the typings.
We do have the option to use the
Extract
utility, but it’s not a great experience. Here’s an example that demonstrates the complexity of this process.Hi, I recently made some changes to name many more response types and export them from this package in #319, so I am going to close this issue. These changes are available in version 2.1.0 of the SDK.
Note that I have not exported all types per the request from this issue, but every exported type requires a stability guarantee from us so I’ve been somewhat judicious. You can still extract types using TypeScript helpers like type indexes and Extract<>, where necessary. If there are any more specific issues around types please open a new GitHub issue, thank you!