-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore: TS explicit module S2 #8397
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
base: main
Are you sure you want to change the base?
Conversation
Build successful! 🎉 |
Build successful! 🎉 |
@snowystinger I'm not sure what specifically about the |
it's not inferring the type, i have to say what it is despite passing it to the TreeView |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
export const AccordionContext: | ||
Context<ContextValue<Partial<AccordionProps>, DOMRefValue<HTMLDivElement>>> = | ||
createContext<ContextValue<Partial<AccordionProps>, DOMRefValue<HTMLDivElement>>>(null); |
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.
You don't need to repeat the types twice:
export const AccordionContext: | |
Context<ContextValue<Partial<AccordionProps>, DOMRefValue<HTMLDivElement>>> = | |
createContext<ContextValue<Partial<AccordionProps>, DOMRefValue<HTMLDivElement>>>(null); | |
export const AccordionContext: Context<ContextValue<Partial<AccordionProps>, DOMRefValue<HTMLDivElement>>> = createContext(null); |
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.
ah, hadn't noticed that from the ts quick fix, I can update those
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.
nope, need to have it apparently...
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.
@@ -68,7 +70,9 @@ const container = style({ | |||
/** | |||
* An avatar group is a grouping of avatars that are related to each other. | |||
*/ | |||
export const AvatarGroup = forwardRef(function AvatarGroup(props: AvatarGroupProps, ref: DOMRef<HTMLDivElement>) { | |||
export const AvatarGroup: | |||
ForwardRefExoticComponent<AvatarGroupProps & RefAttributes<DOMRefValue<HTMLDivElement>>> = |
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.
😭 whyyyyyy
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.
yeah.... it's awful
# Conflicts: # packages/@react-spectrum/s2/src/Tabs.tsx
# Conflicts: # packages/@react-spectrum/s2/src/Slider.tsx
Build successful! 🎉 |
## API Changes
@react-spectrum/s2/@react-spectrum/s2:TreeView-TreeView {
+TreeView <T extends {}> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
children?: ReactNode | (T) => ReactNode
defaultExpandedKeys?: Iterable<Key>
defaultSelectedKeys?: 'all' | Iterable<Key>
dependencies?: ReadonlyArray<any>
disabledBehavior?: DisabledBehavior = 'all'
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
expandedKeys?: Iterable<Key>
id?: string
isDetached?: boolean
isEmphasized?: boolean
items?: Iterable<T>
onAction?: (Key) => void
onExpandedChange?: (Set<Key>) => any
onSelectionChange?: (Selection) => void
renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
selectedKeys?: 'all' | Iterable<Key>
selectionMode?: SelectionMode
shouldSelectOnPressUp?: boolean
slot?: string | null
styles?: StylesPropWithHeight
} /@react-spectrum/s2:TreeViewProps-TreeViewProps {
+TreeViewProps <T> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
children?: ReactNode | (T) => ReactNode
defaultExpandedKeys?: Iterable<Key>
defaultSelectedKeys?: 'all' | Iterable<Key>
dependencies?: ReadonlyArray<any>
disabledBehavior?: DisabledBehavior = 'all'
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
expandedKeys?: Iterable<Key>
id?: string
isDetached?: boolean
isEmphasized?: boolean
items?: Iterable<T>
onAction?: (Key) => void
onExpandedChange?: (Set<Key>) => any
onSelectionChange?: (Selection) => void
renderEmptyState?: (TreeEmptyStateRenderProps) => ReactNode
selectedKeys?: 'all' | Iterable<Key>
selectionMode?: SelectionMode
shouldSelectOnPressUp?: boolean
slot?: string | null
styles?: StylesPropWithHeight
} |
Closes
Same test instructions as #8375
Types should match https://app.unpkg.com/@react-spectrum/[email protected]/files/dist/types.d.ts
Note, I was more thorough on our S2 stories than I was with v3 because it's our documentation and it was easier to align them since they were already fairly close. I'd recommend writing all future stories in this style.
I found a handful of type errors in our stories as a result. I've corrected those. No changes to the source types :)
I think we may still be missing a generic on TreeView? @LFDanLu please have a look at the changes I made in the stories around
TreeExampleDynamic
.ran chromatic https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=969 only changes are expected because I fixed some types
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: