chore: fix typo

This commit is contained in:
Simon Chan 2023-06-04 23:31:01 +08:00
parent 94ae82eef3
commit b263884352
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
10 changed files with 15 additions and 14 deletions

View file

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [16.x, 18.x] node-version: [18.x]
steps: steps:
- name: Checkout - name: Checkout

View file

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x, 20.x] node-version: [18.x]
steps: steps:
- name: Checkout - name: Checkout

View file

@ -15,6 +15,7 @@
"CNXN", "CNXN",
"colour", "colour",
"comlink", "comlink",
"concat",
"Demuxer", "Demuxer",
"Deserialization", "Deserialization",
"DESERIALIZERS", "DESERIALIZERS",

View file

@ -35,7 +35,7 @@ export class AdbReverseNotSupportedError extends AdbReverseError {
} }
const AdbReverseErrorResponse = new Struct() const AdbReverseErrorResponse = new Struct()
.fields(AdbReverseStringResponse) .concat(AdbReverseStringResponse)
.postDeserialize((value) => { .postDeserialize((value) => {
// https://issuetracker.google.com/issues/37066218 // https://issuetracker.google.com/issues/37066218
// ADB on Android <9 can't create reverse tunnels when connected wirelessly (ADB over WiFi), // ADB on Android <9 can't create reverse tunnels when connected wirelessly (ADB over WiFi),

View file

@ -11,7 +11,7 @@ export interface AdbSyncEntry extends AdbSyncStat {
} }
export const AdbSyncEntryResponse = new Struct({ littleEndian: true }) export const AdbSyncEntryResponse = new Struct({ littleEndian: true })
.fields(AdbSyncLstatResponse) .concat(AdbSyncLstatResponse)
.uint32("nameLength") .uint32("nameLength")
.string("name", { lengthField: "nameLength" }) .string("name", { lengthField: "nameLength" })
.extra({ id: AdbSyncResponseId.Entry as const }); .extra({ id: AdbSyncResponseId.Entry as const });
@ -20,7 +20,7 @@ export type AdbSyncEntryResponse =
(typeof AdbSyncEntryResponse)["TDeserializeResult"]; (typeof AdbSyncEntryResponse)["TDeserializeResult"];
export const AdbSyncEntry2Response = new Struct({ littleEndian: true }) export const AdbSyncEntry2Response = new Struct({ littleEndian: true })
.fields(AdbSyncStatResponse) .concat(AdbSyncStatResponse)
.uint32("nameLength") .uint32("nameLength")
.string("name", { lengthField: "nameLength" }) .string("name", { lengthField: "nameLength" })
.extra({ id: AdbSyncResponseId.Entry2 as const }); .extra({ id: AdbSyncResponseId.Entry2 as const });

View file

@ -20,7 +20,7 @@ export const AdbSyncNumberRequest = new Struct({ littleEndian: true })
.uint32("arg"); .uint32("arg");
export const AdbSyncDataRequest = new Struct({ littleEndian: true }) export const AdbSyncDataRequest = new Struct({ littleEndian: true })
.fields(AdbSyncNumberRequest) .concat(AdbSyncNumberRequest)
.uint8Array("data", { lengthField: "arg" }); .uint8Array("data", { lengthField: "arg" });
export interface AdbSyncWritable { export interface AdbSyncWritable {

View file

@ -23,7 +23,7 @@ export type AdbPacketHeader = (typeof AdbPacketHeader)["TDeserializeResult"];
type AdbPacketHeaderInit = (typeof AdbPacketHeader)["TInit"]; type AdbPacketHeaderInit = (typeof AdbPacketHeader)["TInit"];
export const AdbPacket = new Struct({ littleEndian: true }) export const AdbPacket = new Struct({ littleEndian: true })
.fields(AdbPacketHeader) .concat(AdbPacketHeader)
.uint8Array("payload", { lengthField: "payloadLength" }); .uint8Array("payload", { lengthField: "payloadLength" });
export type AdbPacket = (typeof AdbPacket)["TDeserializeResult"]; export type AdbPacket = (typeof AdbPacket)["TDeserializeResult"];

View file

@ -45,7 +45,7 @@ export interface ScrcpyOptionsInit1_18
} }
export const ScrcpyBackOrScreenOnControlMessage1_18 = new Struct() export const ScrcpyBackOrScreenOnControlMessage1_18 = new Struct()
.fields(ScrcpyBackOrScreenOnControlMessage1_16) .concat(ScrcpyBackOrScreenOnControlMessage1_16)
.uint8("action", placeholder<AndroidKeyEventAction>()); .uint8("action", placeholder<AndroidKeyEventAction>());
export type ScrcpyBackOrScreenOnControlMessage1_18 = export type ScrcpyBackOrScreenOnControlMessage1_18 =

View file

@ -6,7 +6,7 @@ import {
} from "../1_16/index.js"; } from "../1_16/index.js";
export const ScrcpyInjectScrollControlMessage1_22 = new Struct() export const ScrcpyInjectScrollControlMessage1_22 = new Struct()
.fields(ScrcpyInjectScrollControlMessage1_16) .concat(ScrcpyInjectScrollControlMessage1_16)
.int32("buttons"); .int32("buttons");
export type ScrcpyInjectScrollControlMessage1_22 = export type ScrcpyInjectScrollControlMessage1_22 =

View file

@ -60,7 +60,7 @@ const buffer = MyStruct.serialize({
- [`int8`/`uint8`/`int16`/`uint16`/`int32`/`uint32`](#int8uint8int16uint16int32uint32) - [`int8`/`uint8`/`int16`/`uint16`/`int32`/`uint32`](#int8uint8int16uint16int32uint32)
- [`int64`/`uint64`](#int64uint64-1) - [`int64`/`uint64`](#int64uint64-1)
- [`uint8Array`/`string`](#uint8arraystring) - [`uint8Array`/`string`](#uint8arraystring)
- [`fields`](#fields) - [`concat`](#concat)
- [`extra`](#extra) - [`extra`](#extra)
- [`postDeserialize`](#postdeserialize) - [`postDeserialize`](#postdeserialize)
- [`deserialize`](#deserialize) - [`deserialize`](#deserialize)
@ -332,10 +332,10 @@ The `options` parameter defines its length, it supports two formats:
- `{ length: number }`: Presence of the `length` option indicates that it's a fixed length array. - `{ length: number }`: Presence of the `length` option indicates that it's a fixed length array.
- `{ lengthField: string; lengthFieldRadix?: number }`: Presence of the `lengthField` option indicates it's a variable length array. The `lengthField` options must refers to a `number` or `string` (can't be `bigint`) typed field that's already defined in this `Struct`. If the length field is a `string`, the optional `lengthFieldRadix` option (defaults to `10`) defines the radix when converting the string to a number. When deserializing, it will use that field's value as its length. When serializing, it will write its length to that field. - `{ lengthField: string; lengthFieldRadix?: number }`: Presence of the `lengthField` option indicates it's a variable length array. The `lengthField` options must refers to a `number` or `string` (can't be `bigint`) typed field that's already defined in this `Struct`. If the length field is a `string`, the optional `lengthFieldRadix` option (defaults to `10`) defines the radix when converting the string to a number. When deserializing, it will use that field's value as its length. When serializing, it will write its length to that field.
#### `fields` #### `concat`
```ts ```ts
fields< concat<
TOther extends Struct<any, any, any, any> TOther extends Struct<any, any, any, any>
>( >(
other: TOther other: TOther
@ -356,7 +356,7 @@ Merges (flats) another `Struct`'s fields and extra fields into the current one.
```ts ```ts
const MyStructV1 = new Struct().int32("field1"); const MyStructV1 = new Struct().int32("field1");
const MyStructV2 = new Struct().fields(MyStructV1).int32("field2"); const MyStructV2 = new Struct().concat(MyStructV1).int32("field2");
const structV2 = await MyStructV2.deserialize(stream); const structV2 = await MyStructV2.deserialize(stream);
structV2.field1; // number structV2.field1; // number
@ -369,7 +369,7 @@ Merges (flats) another `Struct`'s fields and extra fields into the current one.
```ts ```ts
const MyStructV1 = new Struct().int32("field1"); const MyStructV1 = new Struct().int32("field1");
const MyStructV2 = new Struct().int32("field2").fields(MyStructV1); const MyStructV2 = new Struct().int32("field2").concat(MyStructV1);
const structV2 = await MyStructV2.deserialize(stream); const structV2 = await MyStructV2.deserialize(stream);
structV2.field1; // number structV2.field1; // number