-
Notifications
You must be signed in to change notification settings - Fork 1.4k
docs: Type check examples #9299
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
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
…ged" This reverts commit f7ec69e.
|
Build successful! 🎉 |
| }); | ||
|
|
||
| export interface RowProps<T> extends Pick<RACRowProps<T>, 'id' | 'columns' | 'children' | 'textValue' | 'dependencies' | keyof GlobalDOMAttributes> {} | ||
| export interface RowProps<T> extends Pick<RACRowProps<T>, 'id' | 'columns' | 'isDisabled' | 'onAction' | 'children' | 'textValue' | 'dependencies' | keyof GlobalDOMAttributes>, LinkDOMProps {} |
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.
Prop type fixes
| * SelectBoxGroup allows users to select one or more options from a list. | ||
| */ | ||
| export const SelectBoxGroup = /*#__PURE__*/ forwardRef(function SelectBoxGroup<T extends object>(props: SelectBoxGroupProps<T>, ref: DOMRef<HTMLDivElement>) { | ||
| export const SelectBoxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function SelectBoxGroup<T extends object>(props: SelectBoxGroupProps<T>, ref: DOMRef<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.
Props type fix
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| // Read entries in directory and update state with relevant info. | ||
| let getFiles = async (dir) => { | ||
| let files = []; | ||
| let getFiles = async (dir: {getEntries(): AsyncIterable<{name: string, kind: string}>}): Promise<DirItem[]> => { |
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.
Can you use DirectoryDropItem as the type for this?
| let getFiles = async (dir: {getEntries(): AsyncIterable<{name: string, kind: string}>}): Promise<DirItem[]> => { | |
| let getFiles = async (dir: DirectoryDropItem): Promise<DirItem[]> => { |
| name: entry.name, | ||
| kind: entry.kind, | ||
| children: entry.kind === 'directory' ? await getFiles(entry) : [] | ||
| children: entry.kind === 'directory' ? await getFiles(entry as any) : [] |
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 we use DirectoryDropItem this shouldn't be necessary?
|
Build successful! 🎉 |
|
|
||
| export interface Pokemon { | ||
| id: number, | ||
| id?: number, |
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.
is this really optional? every pokemon has a number
| let ref = useRef<HTMLDivElement>(null); | ||
| let [isSubmenuOpen, setIsSubmenuOpen] = useState(false); | ||
| let [hovered, setHovered] = useState('Option 1'); | ||
| let [, setIsSubmenuOpen] = useState(false); |
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.
are these needed?
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.
This component was commented out for now. I think @devongovett might add it back later? Just wanted to clean it up so the build passes.
|
Build successful! 🎉 |
## API Changes
react-aria-components/react-aria-components:RangeValue+RangeValue <T> {
+ end: T
+ start: T
+}@react-spectrum/s2/@react-spectrum/s2:SelectBoxGroup SelectBoxGroup <T extends {}> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
- children: ReactNode
+ children: ReactNode | ({}) => ReactNode
defaultSelectedKeys?: 'all' | Iterable<Key>
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
isDisabled?: boolean
items?: Iterable<T>
onBlur?: (FocusEvent<Target>) => void
onFocus?: (FocusEvent<Target>) => void
onFocusChange?: (boolean) => void
onSelectionChange?: (Selection) => void
orientation?: Orientation = 'vertical'
selectedKeys?: 'all' | Iterable<Key>
selectionMode?: 'single' | 'multiple' = 'single'
slot?: string | null
styles?: StylesProp
}/@react-spectrum/s2:Row Row <T extends {}> {
children?: ReactNode | (T) => ReactElement
columns?: Iterable<T>
dependencies?: ReadonlyArray<any>
+ download?: boolean | string
+ href?: Href
+ hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
+ ping?: string
+ referrerPolicy?: HTMLAttributeReferrerPolicy
+ rel?: string
+ routerOptions?: RouterOptions
+ target?: HTMLAttributeAnchorTarget
textValue?: string
}/@react-spectrum/s2:SelectBoxGroupProps SelectBoxGroupProps <T> {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean | FocusStrategy
- children: ReactNode
+ children: ReactNode | (T) => ReactNode
defaultSelectedKeys?: 'all' | Iterable<Key>
disabledKeys?: Iterable<Key>
disallowEmptySelection?: boolean
escapeKeyBehavior?: 'clearSelection' | 'none' = 'clearSelection'
isDisabled?: boolean
items?: Iterable<T>
onBlur?: (FocusEvent<Target>) => void
onFocus?: (FocusEvent<Target>) => void
onFocusChange?: (boolean) => void
onSelectionChange?: (Selection) => void
orientation?: Orientation = 'vertical'
selectedKeys?: 'all' | Iterable<Key>
selectionMode?: 'single' | 'multiple' = 'single'
slot?: string | null
styles?: StylesProp
}/@react-spectrum/s2:RowProps RowProps <T> {
children?: ReactNode | (T) => ReactElement
columns?: Iterable<T>
dependencies?: ReadonlyArray<any>
+ download?: boolean | string
+ href?: Href
+ hrefLang?: string
id?: Key
+ isDisabled?: boolean
+ onAction?: () => void
+ ping?: string
+ referrerPolicy?: HTMLAttributeReferrerPolicy
+ rel?: string
+ routerOptions?: RouterOptions
+ target?: HTMLAttributeAnchorTarget
textValue?: string
} |
Still need to fix the errors