Skip to content

Suggestion: Create an option to use JSON values instead of unknown. #675

@ghost

Description

Instead generating unknown types, e.g.:

[k: string]: unknown;

I would suggest:

type JsonObject = {[Key in string]: JsonValue};
type JsonArray = JsonValue[] | readonly JsonValue[];
type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
type JsonProperty = JsonValue | unknown;

...

[k: string]: JsonProperty;

I'd actually suggest this be the default behavior, with an option to disable it, and a version bump, but that might be too extreme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions