Skip to content
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

fix: adjust codec exports to make TS defn's more correct #117

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Sep 3, 2021

(and update deps)
FIxes #116 I believe

types/codecs/json.d.ts is now:

export const name: "json";
export const code: 512;
export function encode<T>(node: T): ByteView<T>;
export function decode<T>(data: ByteView<T>): T;
export type ByteView<T> = import('./interface').ByteView<T>;
//# sourceMappingURL=json.d.ts.map

(previous is https://unpkg.com/browse/multiformats@9.4.6/types/codecs/json.d.ts)

types/codecs/raw.d.ts is now:

/**
 * @template T
 * @typedef {import('./interface').ByteView<T>} ByteView
 */
export const name: "raw";
export const code: 85;
export function encode(node: Uint8Array): ByteView<Uint8Array>;
export function decode(data: ByteView<Uint8Array>): Uint8Array;
export type ByteView<T> = import('./interface').ByteView<T>;
//# sourceMappingURL=raw.d.ts.map

(previous is https://unpkg.com/browse/multiformats@9.4.6/types/codecs/raw.d.ts)

I don't know why raw.d.ts gets the jsdoc insert while json.d.ts doesn't, but I'm hoping that doesn't matter since we're getting encode<T> and decode<T> on json.d.ts where it matters.

/cc @woss

@rvagg rvagg merged commit 1caf6fd into master Sep 3, 2021
@rvagg rvagg deleted the rvagg/codec-ts-defns branch September 3, 2021 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation fails on Cannot find name 'T'
2 participants