Please save me some time and use the following template. In 90% of all issues I can't reproduce the problem because I don't know what exactly you are doing, in which environment, or which y-* version is responsible. Just use the following template even if you think the problem is obvious.
Checklist
[x] Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
[x] Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/
Describe the bug
I'm using TypeScript, and want to pass the URL for a local signaling server to the WebRtcProvider. My code has:
const provider = new WebrtcProvider('testApp', ydoc, { signaling: ['wss://localhost:4444'] })
This produces an error from the TypeScript compiler, because the elements of the peerOpts structure are not marked as optional:
ERROR in src/views/YjsTest.vue:12:57
TS2345: Argument of type '{ signaling: string[]; }' is not assignable to parameter of type
'{ signaling: string[]; password: string | null; awareness: Awareness; maxConns: number; filterBcConns:
boolean; peerOpts: any; }'.
Type '{ signaling: string[]; }' is missing the following properties from type '{ signaling: string[];
password: string | null; awareness: Awareness; maxConns: number; filterBcConns: boolean; peerOpts: any; }':
password, awareness, maxConns, filterBcConns, peerOpts
10 |
11 | const ydoc = new Y.Doc()
> 12 | const provider = new WebrtcProvider('dystil', ydoc, { signaling: ['http://localhost:4444'] })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To Reproduce
Steps to reproduce the behavior:
Create a skeleton app that creates a WebRtcCompiler
pass the URL of a non-default signalling server
compile with TypeScript
See error
Expected behavior
It should be possible to pass only a subset of the elements of the options, with the non-specified options falling back to their default values
Screenshots
Not applicable
Environment Information
Typescript 4.4.4
"y-webrtc": "^10.2.0",
"yjs": "^13.5.16"
Additional context
Add any other context about the problem here.
Checklist
Describe the bug
I'm using TypeScript, and want to pass the URL for a local
signaling
server to theWebRtcProvider
. My code has:This produces an error from the TypeScript compiler, because the elements of the
peerOpts
structure are not marked as optional:To Reproduce Steps to reproduce the behavior:
Expected behavior
It should be possible to pass only a subset of the elements of the options, with the non-specified options falling back to their default values
Screenshots
Not applicable
Environment Information
Additional context Add any other context about the problem here.