-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
chore(project): add initial typescript setup and config #11533
chore(project): add initial typescript setup and config #11533
Conversation
✅ Deploy Preview for carbon-components-react ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
||
import * as React from 'react'; | ||
|
||
type IconSize = 16 | 20 | 24 | 32 | '16' | '20' | '24' | '32' | number | string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is changed to ... | '32' | (number & {}) | (string & {})
then autocomplete in IDE's will prefer the actual values rather than a generic string/number but still won't force it. See microsoft/TypeScript#29729 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshblack Are there numbers outside of 16, 20, 24, and 32 that an Icon can use?
Are there plans to revive this PR? One of the maintainers recommended generating a single If type definitions are shipped with the package, |
There was another suggestion on DT, that could be even better, using inline JSDoc comments ( |
@tay1orjones Given the renewed TypeScript effort, could this PR be revived and merged? I think this PR gets the best of both worlds because it fully supports TS without needing to rewrite the package in TS. It appears to carry low risk while solving the need for typing this high-demand package. EDIT: To avoid spamming this thread, I copied this branch and submitted it as a new PR: #12034 |
### Related Ticket(s) Closes carbon-design-system#11500 ### Description updates modal to latest AI gradient updates ### Changelog **New** - modal now checks if footer slotted for styles **Changed** - modal-footer reverted code back to only checking if there are three buttons - updated styles **Removed** - {{removed thing}} <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
Closes #11317
This PR creates an initial TypeScript setup within the project for us to experiment with for the
@carbon/icons-react
package. It also includes an initial implementation of the types for this package based on what exists in DefinitelyTyped.Changelog
New
Icon.d.ts
to the icons-react packageChanged
index.d.ts
file in a packageRemoved
Testing / Reviewing
typecheck
command to identify type errors