Skip to content

Commit

Permalink
Forgotten export
Browse files Browse the repository at this point in the history
  • Loading branch information
untio11 committed Nov 18, 2024
1 parent 2888f0f commit 78a2882
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions etc/types.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,6 @@ export type PropertyInfo<T extends Type<unknown> = Type<unknown>> = {
type: T;
};

// Warning: (ae-forgotten-export) The symbol "Unwidened" needs to be exported by the entry point index.d.ts
//
// @public
export function record<KeyType extends number | string, ValueType>(...args: [name: string, keyType: BaseTypeImpl<KeyType>, valueType: BaseTypeImpl<Unwidened<ValueType>>, strict?: boolean] | [keyType: BaseTypeImpl<KeyType>, valueType: BaseTypeImpl<Unwidened<ValueType>>, strict?: boolean]): TypeImpl<RecordType<BaseTypeImpl<KeyType>, KeyType, BaseTypeImpl<ValueType>, ValueType>>;

Expand Down Expand Up @@ -615,6 +613,9 @@ export type unknownRecord = Record<string, unknown>;
// @public
export const unknownRecord: Type<unknownRecord>;

// @public
export type Unwidened<T> = T extends T ? T : never;

// @public
export type ValidationDetails = {
type: BaseTypeImpl<unknown>;
Expand Down
1 change: 1 addition & 0 deletions markdown/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Runtime type-validation with derived TypeScript types.
| [UnbrandValues](./types.unbrandvalues.md) | |
| [unknownArray](./types.unknownarray.md) | Built-in validator that accepts all arrays. |
| [unknownRecord](./types.unknownrecord.md) | Built-in validator that accepts all objects (<code>null</code> is not accepted). |
| [Unwidened](./types.unwidened.md) | Small helper type that somehow nudges TS compiler to not widen branded string and number types to their base type. |
| [ValidationDetails](./types.validationdetails.md) | Information about the performed validation for error-reporting. |
| [ValidationMode](./types.validationmode.md) | The validation mode to use. |
| [ValidationResult](./types.validationresult.md) | The possible return values inside validation and constraint functions. |
Expand Down
6 changes: 3 additions & 3 deletions markdown/types.record.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ declare function record<KeyType extends number | string, ValueType>(

## Parameters

| Parameter | Type | Description |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| args | \[name: string, keyType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;KeyType&gt;, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;Unwidened&lt;ValueType&gt;&gt;, strict?: boolean\] \| \[keyType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;KeyType&gt;, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;Unwidened&lt;ValueType&gt;&gt;, strict?: boolean\] | |
| Parameter | Type | Description |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| args | \[name: string, keyType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;KeyType&gt;, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;[Unwidened](./types.unwidened.md)<!-- -->&lt;ValueType&gt;&gt;, strict?: boolean\] \| \[keyType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;KeyType&gt;, valueType: [BaseTypeImpl](./types.basetypeimpl.md)<!-- -->&lt;[Unwidened](./types.unwidened.md)<!-- -->&lt;ValueType&gt;&gt;, strict?: boolean\] | |

**Returns:**

Expand Down
13 changes: 13 additions & 0 deletions markdown/types.unwidened.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@skunkteam/types](./types.md) &gt; [Unwidened](./types.unwidened.md)

## Unwidened type

Small helper type that somehow nudges TS compiler to not widen branded string and number types to their base type.

**Signature:**

```typescript
type Unwidened<T> = T extends T ? T : never;
```
2 changes: 1 addition & 1 deletion src/types/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ define(
);

/** Small helper type that somehow nudges TS compiler to not widen branded string and number types to their base type. */
type Unwidened<T> = T extends T ? T : never;
export type Unwidened<T> = T extends T ? T : never;
/**
* Note: record has strict validation by default, while type does not have strict validation, both are strict in construction though. TODO: document
*/
Expand Down

0 comments on commit 78a2882

Please sign in to comment.