question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: Add typescript types

See original GitHub issue

Add typescript types: Typescript definition files would provide better documentation built into our editors themselves.

Detailed description

This is more of a discussion rather than an issue itself. We’ve started using typescript over many of our apps and I’m trying to identify what we can do to add more documentation wherever we can. I’ve found a library react-to-typescript-definitions that provides some ability to generate types from prop types. However, the library doesn’t fit to some of our setup and we have a few exceptions that aren’t supported by the tool. We would need to manually edit the output somewhat.

How do people feel about supporting type definition files? I was thinking that each component would have a type file (types.d.ts) within the directory to explain it’s exports. We would need to do some processing on those files to combine in to a single types definition.

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:35 (16 by maintainers)

github_iconTop GitHub Comments

4reactions
vpiconecommented, Feb 11, 2019

I ported the project to TypeScript so that folks can play with writing types (for DefinitelyTyped or otherwise). It has jest/storybook/compile configured for both ts/js files.

https://github.com/vpicone/carbon-components-react/tree/ts

I’m working my way through the components alphabetically in my spare time to uncover any PropType inconsistencies.

3reactions
johnnyreillycommented, Feb 11, 2019

Hey - Definitely Typed maintainer here. I’d be happy to help getting this into DT. Raise a PR and ping me and I’ll help with the merge process 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: Adding Custom Type Definitions for Existing ...
In these circumstances, you have to add your own custom type definitions for the libraries. This article will show you how to that....
Read more >
Documentation - The Basics - TypeScript
The type-checker has information to check things like whether we're accessing the right properties on variables and other properties. Once it has that ......
Read more >
Surviving the TypeScript Ecosystem — Part 4 - Medium
This post is going to cover a lot of the peculiarities around TypeScript and the TypeScript ecosystem. This is mostly around integrating with...
Read more >
Discussion of The Trouble with TypeScript - DEV Community ‍ ‍
I only add type annotations where strictly needed, I let type-inference do the work for me. I don't spend much time writing types....
Read more >
TypeScript - Cypress Documentation
Type "restart ts" and select the "TypeScript: Restart TS server." option. If that does not work, try restarting the IDE. Types for Custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found