Skip to content

Examples not working #64

@davidyuk

Description

@davidyuk

I've cloned this repo, did npm i and according to https://github.com/airgap-it/airgap-coin-lib/blob/master/examples/readme.md

$ npx ts-node examples/serializer/create-qr.ts 
/usr/local/lib/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
examples/serializer/create-qr.ts:6:3 - error TS2322: Type 'number' is not assignable to type 'string'.

6   id: generateId(8),
    ~~

  packages/serializer/src/v2/message.ts:22:3
    22   id: string
         ~~
    The expected type comes from property 'id' which is declared here on type 'IACMessageDefinitionObject'
examples/serializer/create-qr.ts:37:3 - error TS2322: Type 'number' is not assignable to type 'string'.

37   id: generateId(8),
     ~~

  packages/serializer/src/v2/message.ts:22:3
    22   id: string
         ~~
    The expected type comes from property 'id' which is declared here on type 'IACMessageDefinitionObject'
examples/serializer/create-qr.ts:48:20 - error TS2673: Constructor of class 'SerializerV3' is private and only accessible within the class declaration.

48 const serializer = new SerializerV3()
                      ~~~~~~~~~~~~~~~~~~
examples/serializer/create-qr.ts:52:16 - error TS7006: Parameter 'serialized' implicitly has an 'any' type.

52   .then(async (serialized) => {
                  ~~~~~~~~~~

    at createTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
  diagnosticCodes: [ 2322, 2322, 2673, 7006 ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions