You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { Json, stringify } from "fp-ts/lib/Json.js";
import * as O from "fp-ts/lib/Option.js";
type A = O.Option<string>;
const a = O.none;
const serialize = <V extends Json>(value: V) => stringify(value);
serialize(a); // <-- type signature does not match
a does not extend Json
Argument of type 'Option<never>' is not assignable to parameter of type 'Json'.
Type 'None' is not assignable to type 'Json'.
Type 'None' is not assignable to type 'JsonRecord'.
Index signature for type 'string' is missing in type 'None'.
But obviously the object is json-serializable
export interface None {
readonly _tag: 'None'
}
Desired Behavior
Suggested Solution
Who does this impact? Who is this for?
Describe alternatives you've considered
Additional context
Your environment
Software
Version(s)
fp-ts
TypeScript
The text was updated successfully, but these errors were encountered:
The interface would need to have an index signature for type string for that to be possible.
As noted by Index signature for type 'string' is missing in type 'None'.
Seems to me at least that this is better solved in userland by just adding an index signature with a predicate function or some such.
🚀 Feature request
Current Behavior
a
does not extend JsonBut obviously the object is json-serializable
Desired Behavior
Suggested Solution
Who does this impact? Who is this for?
Describe alternatives you've considered
Additional context
Your environment
The text was updated successfully, but these errors were encountered: