From 2888f0f01e46744d6690ac31243e297be4b5bd8f Mon Sep 17 00:00:00 2001 From: Robin Kneepkens Date: Mon, 18 Nov 2024 17:08:27 +0100 Subject: [PATCH] Updated API docs. --- etc/types.api.md | 4 +++- markdown/types.record.md | 10 +++++----- src/types/intersection.ts | 5 +---- src/types/number.ts | 2 +- src/types/record.ts | 7 +------ src/types/union.ts | 5 +---- 6 files changed, 12 insertions(+), 21 deletions(-) diff --git a/etc/types.api.md b/etc/types.api.md index 1b5e561..0c039c5 100644 --- a/etc/types.api.md +++ b/etc/types.api.md @@ -427,8 +427,10 @@ export type PropertyInfo = Type> = { type: T; }; +// Warning: (ae-forgotten-export) The symbol "Unwidened" needs to be exported by the entry point index.d.ts +// // @public -export function record(...args: [name: string, keyType: BaseTypeImpl, valueType: BaseTypeImpl, strict?: boolean] | [keyType: BaseTypeImpl, valueType: BaseTypeImpl, strict?: boolean]): TypeImpl, KeyType, BaseTypeImpl, ValueType>>; +export function record(...args: [name: string, keyType: BaseTypeImpl, valueType: BaseTypeImpl>, strict?: boolean] | [keyType: BaseTypeImpl, valueType: BaseTypeImpl>, strict?: boolean]): TypeImpl, KeyType, BaseTypeImpl, ValueType>>; // @public export class RecordType, KeyType extends number | string, ValueTypeImpl extends BaseTypeImpl, ValueType, ResultType extends Record = Record> extends BaseTypeImpl { diff --git a/markdown/types.record.md b/markdown/types.record.md index 8d66536..9e3d918 100644 --- a/markdown/types.record.md +++ b/markdown/types.record.md @@ -11,16 +11,16 @@ Note: record has strict validation by default, while type does not have strict v ```typescript declare function record( ...args: - | [name: string, keyType: BaseTypeImpl, valueType: BaseTypeImpl, strict?: boolean] - | [keyType: BaseTypeImpl, valueType: BaseTypeImpl, strict?: boolean] + | [name: string, keyType: BaseTypeImpl, valueType: BaseTypeImpl>, strict?: boolean] + | [keyType: BaseTypeImpl, valueType: BaseTypeImpl>, strict?: boolean] ): TypeImpl, KeyType, BaseTypeImpl, ValueType>>; ``` ## Parameters -| Parameter | Type | Description | -| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| args | \[name: string, keyType: [BaseTypeImpl](./types.basetypeimpl.md)<KeyType>, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<ValueType>, strict?: boolean\] \| \[keyType: [BaseTypeImpl](./types.basetypeimpl.md)<KeyType>, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<ValueType>, strict?: boolean\] | | +| Parameter | Type | Description | +| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| args | \[name: string, keyType: [BaseTypeImpl](./types.basetypeimpl.md)<KeyType>, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<Unwidened<ValueType>>, strict?: boolean\] \| \[keyType: [BaseTypeImpl](./types.basetypeimpl.md)<KeyType>, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<Unwidened<ValueType>>, strict?: boolean\] | | **Returns:** diff --git a/src/types/intersection.ts b/src/types/intersection.ts index e0c0036..02caf89 100644 --- a/src/types/intersection.ts +++ b/src/types/intersection.ts @@ -43,10 +43,7 @@ export class IntersectionType = { function selectBound(key: T, current: NumberTypeConfig, update: NumberTypeConfig): Bound { const exclKey = `${key}Exclusive` as const; - const onlyTheBound = (c: NumberTypeConfig) => ({ [key]: c[key], [exclKey]: c[exclKey] }) as Bound; + const onlyTheBound = (c: NumberTypeConfig) => ({ [key]: c[key], [exclKey]: c[exclKey] } as Bound); const currentPosition: number | undefined = current[key] ?? current[exclKey]; if (currentPosition == null) return onlyTheBound(update); diff --git a/src/types/record.ts b/src/types/record.ts index c14667e..c1741e4 100644 --- a/src/types/record.ts +++ b/src/types/record.ts @@ -23,12 +23,7 @@ export class RecordType< /** {@inheritdoc BaseTypeImpl.typeConfig} */ readonly typeConfig: undefined; - constructor( - readonly keyType: KeyTypeImpl, - readonly valueType: ValueTypeImpl, - name?: string, - readonly strict = true, - ) { + constructor(readonly keyType: KeyTypeImpl, readonly valueType: ValueTypeImpl, name?: string, readonly strict = true) { super(); this.isDefaultName = !name; this.name = name || `Record<${keyType.name}, ${valueType.name}>`; diff --git a/src/types/union.ts b/src/types/union.ts index 8d7428f..d162526 100644 --- a/src/types/union.ts +++ b/src/types/union.ts @@ -31,10 +31,7 @@ export class UnionType< /** {@inheritdoc BaseTypeImpl.typeConfig} */ readonly typeConfig: undefined; - constructor( - readonly types: Types, - name?: string, - ) { + constructor(readonly types: Types, name?: string) { super(); this.isDefaultName = !name; this.name = name || types.map(type => bracketsIfNeeded(type.name, '|')).join(' | ');