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

Typing improvements for io and fixes for websocketclient, and a few others #1429

Open
wants to merge 21 commits into
base: public
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6bc4f6a
Start of io typings work
cmidgley Oct 17, 2024
f3c862b
Adjust namespace for 'config' to `websocketclient/config`
cmidgley Oct 19, 2024
e42b93c
Merge branch 'public' into io-typings
cmidgley Oct 19, 2024
2fe80d7
Revert config.js
cmidgley Oct 19, 2024
65d177e
Reverse webclient manfiest
cmidgley Oct 19, 2024
201906a
Revert TLS include
cmidgley Oct 19, 2024
9a3aa33
Define Device into global namespace to allow augmentation; have WebSo…
cmidgley Oct 19, 2024
afeb566
Removed unused import
cmidgley Oct 19, 2024
04a118f
Fixed module imports to be within declare
cmidgley Oct 19, 2024
b6e275e
More refinements/improvements to tcp/udp/dns/websocket types
cmidgley Oct 20, 2024
365854b
More io types, expanded webpage w/status and headers, fixed up 'this'…
cmidgley Oct 20, 2024
72b162a
Add status codes to http/1.1 response
cmidgley Oct 21, 2024
2d935cb
Fix bug with attach socket
cmidgley Oct 21, 2024
e002eab
Further type improvements for websocketclient
cmidgley Oct 21, 2024
a0c86df
Add onError error messages, don't use masks on server (attached socke…
cmidgley Oct 21, 2024
f88cff5
Fix bug with reversed client/server on mask
cmidgley Oct 22, 2024
b318fce
Switch builtin-global to builtin-device to be consistent with other t…
cmidgley Oct 23, 2024
629663f
Remove unnecessary import
cmidgley Oct 23, 2024
47168b1
Revert prior and apply new fix for attached sockets
cmidgley Oct 24, 2024
876f4e0
Fix type of buffer on onControl
cmidgley Oct 24, 2024
08e1cee
Small improvements on types
cmidgley Oct 27, 2024
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
1 change: 1 addition & 0 deletions test262
Submodule test262 added at 0add42
2 changes: 1 addition & 1 deletion typings/embedded_io/socket/tcp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare module "embedded:io/socket/tcp" {
readonly remoteAddress: string | undefined;
readonly remotePort: number | undefined;
read(): number;
read(byteLength: number): ArrayBuffer;
read(byteLength: number): ArrayBuffer | undefined;
read(buffer: Buffer): void;
write(value: number | Buffer): void;
close(): void;
Expand Down
11 changes: 2 additions & 9 deletions typings/embedded_io/socket/tcp/tls.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module "embedded:io/socket/tcp/tls" {
import { TCPOptions } from "embedded:io/socket/tcp";
import TCP, { TCPOptions } from "embedded:io/socket/tcp";
import UDP from "embedded:io/socket/udp";

export type SSLSessionOptions = {
Expand All @@ -21,12 +21,5 @@ declare module "embedded:io/socket/tcp/tls" {
};
export type TLSDevice = TCPOptions & { io: typeof UDP };

export default class TLSSocket {
constructor(options: TLSOptions);
close(): undefined;
read(count: number | ArrayBufferLike): undefined | ArrayBufferLike;
write(buffer: ArrayBufferLike): number;
set format(format: string);
get format(): string;
}
export default class TLSSocket extends TCP {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm no TypeScript expert, but don't you need to define that the TLSSocket constructor uses TLSOptions instead of TCPOptions for the options object argument?

}
2 changes: 1 addition & 1 deletion typings/embedded_network/websocket/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ declare module "embedded:network/websocket/client" {
export default class WebSocketClient {
constructor(options: WebSocketClientOptions);
close(): void;
read(count?: number): ArrayBuffer;
read(count?: number): ArrayBuffer | undefined;
write(message: Buffer, options?: WebSocketClientWriteOptions): number;

static readonly text: 1;
Expand Down