mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
48 lines
1.8 KiB
Plaintext
48 lines
1.8 KiB
Plaintext
index.tsx(35,13): error TS2322: Type '{ key: string; }' is not assignable to type 'HTMLAttributes<HTMLLIElement>'.
|
|
Property 'key' does not exist on type 'HTMLAttributes<HTMLLIElement>'.
|
|
|
|
|
|
==== index.tsx (1 errors) ====
|
|
interface MiddlewareArray<T> extends Array<T> {}
|
|
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void;
|
|
|
|
declare const defaultMiddleware: MiddlewareArray<any>;
|
|
configureStore({
|
|
middleware: [...defaultMiddleware], // Should not error
|
|
});
|
|
|
|
declare namespace React {
|
|
type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = E;
|
|
interface HTMLAttributes<T> {
|
|
children?: ReactNode;
|
|
}
|
|
type ReactNode = ReactChild | ReactFragment | boolean | null | undefined;
|
|
type ReactText = string | number;
|
|
type ReactChild = ReactText;
|
|
type ReactFragment = {} | ReactNodeArray;
|
|
interface ReactNodeArray extends Array<ReactNode> {}
|
|
}
|
|
declare namespace JSX {
|
|
interface IntrinsicElements {
|
|
ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
|
|
li: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLIElement>, HTMLLIElement>;
|
|
}
|
|
}
|
|
declare var React: any;
|
|
|
|
const Component = () => {
|
|
const categories = ['Fruit', 'Vegetables'];
|
|
|
|
return (
|
|
<ul>
|
|
<li>All</li>
|
|
{categories.map((category) => (
|
|
<li key={category}>{category}</li> // Error about 'key' only
|
|
~~~
|
|
!!! error TS2322: Type '{ key: string; }' is not assignable to type 'HTMLAttributes<HTMLLIElement>'.
|
|
!!! error TS2322: Property 'key' does not exist on type 'HTMLAttributes<HTMLLIElement>'.
|
|
))}
|
|
</ul>
|
|
);
|
|
};
|
|
|