import {JsonValue} from "type-fest";
declare function identity(value: JsonValue): JsonValue;
interface InterfaceObject {
origin: string;
}
const objectViaInterface: InterfaceObject = {
origin: 'red'
};
identity(objectViaInterface);
// Argument of type 'InterfaceObject' is not assignable to parameter of type 'JsonValue'.
// Type 'InterfaceObject' is not assignable to type 'JsonObject'.
// Type 'InterfaceObject' is not assignable to type '{ [x: string]: JsonValue; }'.
// Index signature for type 'string' is missing in type 'InterfaceObject'.(2345)
type TypeObject = {
origin: string;
}
const objectViaType: TypeObject = {
origin: 'red'
};
identity(objectViaType) // Fine
Jsonify
"fixes" the issue in some cases but it breaks in other
Generic issue for:
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too