Provide explicit constraints for TypeScript 4.8 (#1201)

* Add `extends object` constraint to `T` in `assign` helper.

* Add `JSX.IntrinsictAttributes` constraint to `P` in `Tabs`.

* Format

Co-authored-by: Nathan Bierema <nbierema@gmail.com>
This commit is contained in:
Daniel Rosenwasser 2022-07-19 17:25:45 -07:00 committed by GitHub
parent 24f60a7aa7
commit 41ea59b42e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ const objectKeys =
return keys;
};
export default function assign<T, K extends keyof T>(
export default function assign<T extends object, K extends keyof T>(
obj: T,
newKey: K,
newValue: T[K]

View File

@ -18,7 +18,7 @@ export default {
component: Tabs,
};
const Template: Story<TabsProps<unknown>> = (args) => (
const Template: Story<TabsProps<object>> = (args) => (
<Container>
<Tabs {...args} />
</Container>

View File

@ -14,7 +14,7 @@ export interface TabsProps<P> {
position: Position;
}
export default class Tabs<P> extends Component<TabsProps<P>> {
export default class Tabs<P extends object> extends Component<TabsProps<P>> {
SelectedComponent?: React.ComponentType<P>;
selector?: () => P;