-
-
Notifications
You must be signed in to change notification settings - Fork 6
Move public types from .f.mjs JSDoc into authored types.ts
#1483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2cf2511
7ff7095
3398fa3
394abd6
4db11c1
f13fc56
9d4ad11
cbbbec3
ee3a81a
ac5342d
4e05808
c6e64bd
3fc9579
0fe245c
f0ae3b6
6949188
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /** | ||
| * Types for ASN.1 BER/DER encoding and decoding over bit vectors. | ||
| * | ||
| * @module | ||
| */ | ||
|
|
||
| import type { Vec } from '../types/bit_vec/types.ts' | ||
| import type { | ||
| boolean as booleanTag, | ||
| constructedSequence, | ||
| constructedSet, | ||
| integer, | ||
| objectIdentifier, | ||
| octetString, | ||
| } from './module.f.mjs' | ||
|
|
||
| /** | ||
| * ASN.1 tag number. | ||
| */ | ||
| export type _Tag = bigint | ||
|
|
||
| /** | ||
| * Raw ASN.1 TLV tuple. | ||
| */ | ||
| export type Raw = readonly [_Tag, Vec] | ||
|
|
||
| /** | ||
| * ASN.1 OBJECT IDENTIFIER components. | ||
| */ | ||
| export type ObjectIdentifier = readonly bigint[] | ||
|
|
||
| /** | ||
| * ASN.1 ordered collection of records. | ||
| */ | ||
| export type Sequence = readonly Record[] | ||
|
|
||
| /** | ||
| * ASN.1 SET represented as a sequence of records. | ||
| */ | ||
| export type Set = Sequence | ||
|
|
||
| /** | ||
| * Supported ASN.1 record variants. | ||
| */ | ||
| export type SupportedRecord = | ||
| | readonly [typeof booleanTag, boolean] | ||
| | readonly [typeof integer, bigint] | ||
| | readonly [typeof octetString, Vec] | ||
| | readonly [typeof objectIdentifier, ObjectIdentifier] | ||
| | readonly [typeof constructedSequence, Sequence] | ||
| | readonly [typeof constructedSet, Set] | ||
|
|
||
| // Alternative: | ||
| // | ||
| // export type SupportedRecord = | ||
| // | boolean | ||
| // | bigint // integer | ||
| // | { tag: typeof octetString, value: Vec } | ||
| // | { tag: typeof objectIdentifier, value: ObjectIdentifier } | ||
| // | readonly Record[] // sequence | ||
| // | { tag: typeof constructedSet, value: readonly Record[] } | ||
| // | ||
| // export type UnsupportedRecord = | ||
| // | { tag: null, value: Vec } | ||
|
|
||
| /** | ||
| * For unsupported tags, we just store the raw value including the tag and | ||
| * length, so that it can be re-encoded without loss of information. | ||
| */ | ||
| export type UnsupportedRecord = Vec | ||
|
|
||
| export type Record = SupportedRecord | UnsupportedRecord |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * Type-level assertion helpers. | ||
| * | ||
| * @module | ||
| */ | ||
|
|
||
| /** | ||
| * Compile-time-only check: a type resolves only if it is exactly `true`. | ||
| * Used to assert type-level properties without any runtime cost, e.g. | ||
| * `type _ = Assert<Equal<A, B>>`. | ||
| */ | ||
| export type Assert<T extends true> = T | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a contributor follows the mandatory type-level proof guidance in AGENTS.md reference: AGENTS.md:L211-L217 Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6949188. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Types for the shared bit-codec factory. | ||
| * | ||
| * @module | ||
| */ | ||
|
|
||
| import type { Vec } from '../types/bit_vec/types.ts' | ||
| import type { Nullable } from '../types/nullable/types.ts' | ||
|
|
||
| /** | ||
| * The encode/decode pair returned by `baseN` in `./module.f.mjs`. | ||
| */ | ||
| export type BaseN = { | ||
| readonly vecToString: (v: Vec) => string | ||
| readonly stringToVec: (s: string) => Nullable<Vec> | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the required module-level JSDoc header before this declaration; the current comment documents
Assertrather than the module and omits@module. The same omission exists in the newly addedfjs/types/function/types.tsandfjs/types/ordered_map/types.ts, leaving all three type modules without the repository's required module documentation.AGENTS.md reference: AGENTS.md:L252-L265
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 3fc9579. Added
@moduleheaders to all three:fjs/asserts/types.ts("Type-level assertion helpers."),fjs/types/function/types.ts("Types for function composition."),fjs/types/ordered_map/types.ts("Types for the ordered map data structure."). The existingAssertdoc comment stays where it is, now below the module header.Checked the rest of the set while I was in there — the other 30
types.tsfiles already had headers, so these three were the only gaps.