-
-
Notifications
You must be signed in to change notification settings - Fork 620
type: update SpecialString type to use NonNullable #1361
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,7 @@ export interface RenderedCell<RecordType> { | |
| export type Direction = 'ltr' | 'rtl'; | ||
|
|
||
| // SpecialString will be removed in antd@6 | ||
| export type SpecialString<T> = T | (string & unknown); | ||
| export type SpecialString<T> = T | (string & NonNullable<unknown>); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change correctly applies the By including A more correct approach would be to remove export type SpecialString = string & NonNullable<unknown>;This would then require updating its usage in Given this change is out of scope for the current PR, consider creating a follow-up issue or PR to address this typing issue.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gemini-code-assist Don't use {} as a type. {} actually means "any non-nullish value".
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the clarification, @afc163. You are absolutely correct that My primary concern, however, remains with the inclusion of The suggestion to define I believe addressing the |
||
|
|
||
| export type DataIndex<T = any> = | ||
| | DeepNamePath<T> | ||
|
|
||
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.
Using
NonNullable<unknown>is equivalent tounknownsinceunknownis already non-nullable. This change has no practical effect. Consider usingNonNullable<{}>or{}instead if the intent is to exclude null/undefined from the intersection.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.
@copilot Don't use
{}as a type.{}actually means "any non-nullish value".objectinstead.unknowninstead.Record<string, never>instead.NonNullable<unknown>instead.eslint@typescript-eslint/ban-types