sindresorhus/type-fest

Jsonify breaks down with JsonValue, JsonObject

Open

#582 opened on Mar 27, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (471 forks)batch import
bughelp wanted

Repository metrics

Stars
 (12,328 stars)
PR merge metrics
 (Avg merge 3d 5h) (11 merged PRs in 30d)

Description

I was trying to use Jsonify with a generic class and noticed things would break if I happened to pass in a type already using JsonValue or JsonObject:

// type Foo = {[x: string]: never}
type Foo = Jsonify<JsonObject>

// Type instantiation is excessively deep and possibly infinite.ts(2589)
type Bar = Jsonify<JsonValue>;

Contributor guide