Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

chore: fix rpc message typings & clean up some tsdocs #118

Merged
merged 3 commits into from
Jun 18, 2022

Conversation

harrysolovay
Copy link
Contributor

No description provided.

@harrysolovay harrysolovay merged commit 0ffebaa into main Jun 18, 2022
@harrysolovay harrysolovay deleted the fix-rpc-message-typings branch June 18, 2022 14:20
@@ -6,7 +6,7 @@ export type DeriveCodec = (typeI: number) => $.Codec<unknown>;

/**
* All derived codecs for ZSTs will use this exact codec,
* so `derivedCodec === $null` is true iff the type is a ZST.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not a typo – iff in logic is an abbreviation for "if and only if", which is the most accurate description of the contract of $null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, apologies

Comment on lines +14 to +16
export type Flatten<T> = T extends (infer E)[] ? Flatten<E>[]
: T extends object ? { [K in keyof T]: Flatten<T[K]> }
: T;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks Flatten for tuples. I've recently adopted

export type Flatten<T> = [{ [K in keyof T]: Flatten<T[K]> }][0]

with the caveat that it should only be used to wrap things known to be simple objects or arrays

@tjjfvi
Copy link
Contributor

tjjfvi commented Jun 28, 2022

(the above posthumous review is here for convenience, and will be extracted later)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants