Skip to main content

internal.Immutable

Home > @backstage/backend-openapi-utils > internal > Immutable

From https://github.com/microsoft/TypeScript/issues/13923#issuecomment-653675557, allows us to convert from as const to the various OpenAPI types documented in openapi3-ts.

Signature:

export type Immutable<T> = T extends Function | boolean | number | string | null | undefined ? T : T extends Map<infer K, infer V> ? ReadonlyMap<Immutable<K>, Immutable<V>> : T extends Set<infer S> ? ReadonlySet<Immutable<S>> : {
readonly [P in keyof T]: Immutable<T[P]>;
};

References: Immutable