Closed
Description
Version
2.0.0-beta
Code
interface Param {
id: string;
value: number;
}
export function foo(param: Param, readonlyParam: Readonly<Param>) {
JSON.stringify(param); // error
JSON.stringify(readonlyParam);
}
Actual Behavior
Compile error: ts(2769) [6, 18]
No overload matches this call.
Overload 1 of 2, '(value: ReadonlyJSONValue, replacer?: ((this: ReadonlyJSONValue, key: string, value: ReadonlyJSONValue) => any) | undefined, space?: string | ... 1 more ... | undefined): string', gave the following error.
Argument of type 'Param' is not assignable to parameter of type 'ReadonlyJSONValue'.
Type 'Param' is not assignable to type '{ readonly [x: string]: ReadonlyJSONValue | undefined; }'.
Index signature for type 'string' is missing in type 'Param'.
Overload 2 of 2, '(value: ReadonlyJSONValue, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string', gave the following error.
Argument of type 'Param' is not assignable to parameter of type 'ReadonlyJSONValue'.
Expected Behavior
No error