wharfkit / antelope

Core types, client interfaces, and other tools for working with Antelope-based blockchains.
Other
44 stars 23 forks source link

type error when trying to compile my app #52

Closed Rebal67 closed 1 year ago

Rebal67 commented 1 year ago

node_modules/@greymass/eosio/src/serializer/encoder.ts:97:9 - error TS2322: Type 'ABISerializableConstructor | ABITypeDescriptor' is not assignable to type 'ABISerializableConstructor'. Type 'ABITypeDescriptor' is missing the following properties from type 'ABISerializableConstructor': abiName, from type = args.type

node_modules/@greymass/eosio/src/serializer/encoder.ts:98:30 - error TS2339: Property 'abiName' does not exist on type 'ABISerializableConstructor | ABITypeDescriptor'.
Property 'abiName' does not exist on type 'ABITypeDescriptor'.
typeName = args.type.abiName

i am getting these errors when importing the package with yarn or using yarn link to link it. then building my app

jnordberg commented 1 year ago

Hard to say what this could be without a full trace, can you create a isolated example that reproduces it or does it only happen when the package is imported in your app?

theblockstalk commented 1 year ago

this is happening when we import the package into our app

node_modules/@greymass/eosio/src/serializer/encoder.ts:96:39 - error TS2339: Property 'abiName' does not exist on type 'ABISerializableConstructor | ABITypeDescriptor'.
  Property 'abiName' does not exist on type 'ABITypeDescriptor'.

96     } else if (args.type && args.type.abiName !== undefined) {
                                         ~~~~~~~
node_modules/@greymass/eosio/src/serializer/encoder.ts:97:9 - error TS2322: Type 'ABISerializableConstructor | ABITypeDescriptor' is not assignable to type 'ABISerializableConstructor'.
  Type 'ABITypeDescriptor' is missing the following properties from type 'ABISerializableConstructor': abiName, from

97         type = args.type
           ~~~~
node_modules/@greymass/eosio/src/serializer/encoder.ts:98:30 - error TS2339: Property 'abiName' does not exist on type 'ABISerializableConstructor | ABITypeDescriptor'.
  Property 'abiName' does not exist on type 'ABITypeDescriptor'.

98         typeName = args.type.abiName
jnordberg commented 1 year ago

What version of TypeScript are you using? This works fine locally for me and in our tests. If you look at the code in encoder.ts you'll see that in the line above there is a isTypeDescriptor qualifier that should make TS infer the type correctly later on.

theblockstalk commented 1 year ago

checkout https://github.com/Tonomy-Foundation/Tonomy-Communication/tree/d0dfed9b117926094306ed01ed1b49f2cb05a8ed

steps to reproduce

corepack enable
yarn install
yarn run start
theblockstalk commented 1 year ago

typescript ^4.7.4

theblockstalk commented 1 year ago

this seems to have been solved by changing our typescript config: https://github.com/Tonomy-Foundation/Tonomy-Communication/pull/4/commits/c80e69ed156d7dd5aed45c4c8b7d33610bf69d64#diff-b55cdbef4907b7045f32cc5360d48d262cca5f94062e353089f189f4460039e0R16

we added the following:

   "strict": true,
   "useUnknownInCatchVariables": false,
jnordberg commented 1 year ago

Great