mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
768 B
TypeScript
29 lines
768 B
TypeScript
//// [tests/cases/compiler/circularResolvedSignature.ts] ////
|
|
|
|
//// [circularResolvedSignature.ts]
|
|
declare function useState<S>(initialState: (() => S)): [S, (s: S) => void];
|
|
|
|
type Data = Readonly<{
|
|
value: number;
|
|
foo: (arg: any) => void;
|
|
bar: (arg: any) => void;
|
|
}>;
|
|
|
|
export function Component() {
|
|
const [state, setState] = useState<Data>(() => ({
|
|
value: "string", // this should be a number
|
|
foo: (arg) => setState(arg),
|
|
bar: (arg) => setState(arg),
|
|
}));
|
|
}
|
|
|
|
|
|
//// [circularResolvedSignature.js]
|
|
export function Component() {
|
|
const [state, setState] = useState(() => ({
|
|
value: "string", // this should be a number
|
|
foo: (arg) => setState(arg),
|
|
bar: (arg) => setState(arg),
|
|
}));
|
|
}
|