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

chore: use upstream types for compact-encoding #813

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"@sinonjs/fake-timers": "^10.0.2",
"@types/b4a": "^1.6.0",
"@types/bogon": "^1.0.2",
"@types/compact-encoding": "^2.15.0",
"@types/debug": "^4.1.8",
"@types/json-schema": "^7.0.11",
"@types/json-stable-stringify": "^1.0.36",
Expand Down
1 change: 0 additions & 1 deletion types/compact-encoding.d.ts

This file was deleted.

23 changes: 3 additions & 20 deletions types/protomux.d.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
declare module 'protomux' {
import { Duplex } from 'streamx'
import { Duplex as NodeDuplex } from 'stream'

interface PreEncodingState {
buffer: null
start: number
end: number
}

interface EncodingState {
buffer: null | Buffer
start: number
end: number
}

interface Encoding {
preencode(state: PreEncodingState, value: any): void
encode(state: EncodingState, value: any): void
decode(state: EncodingState): any
}
import type cenc from 'compact-encoding'

interface Message {
type: number
send(msg: any): void
onmessage: (message: any) => void
encoding: Encoding
encoding: cenc.Encoder
}

type MessageOptions = Partial<Pick<Message, 'onmessage' | 'encoding'>>
Expand Down Expand Up @@ -65,7 +48,7 @@ declare module 'protomux' {
aliases?: string[]
id?: null | Buffer
unique?: boolean
handshake?: Encoding
handshake?: cenc.Encoder
messages: MessageOptions[]
onopen?(handshake?: any): Promise<void> | void
onclose?(): Promise<void> | void
Expand Down
Loading