Generated ts client files misses override modifier
Closed this issue · 6 comments
The generated client file from json schema from cw_serde could not work properly since it misses the override modifier.
For instance, the generated Poap.client.ts shows:
export class PoapQueryClient implements PoapReadOnlyInterface {
client: CosmWasmClient;
contractAddress: string;
methods...
}
export class PoapClient extends PoapQueryClient implements PoapInterface {
client: SigningCosmWasmClient;
sender: string;
contractAddress: string;
methods...
}Then, thhe error shows:
../types/contracts/poap/Poap.client.ts:133:3 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'PoapQueryClient'.
133 client: SigningCosmWasmClient;
~~~~~~
../types/contracts/poap/Poap.client.ts:135:3 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'PoapQueryClient'.
135 contractAddress: string;
After adding override modifier to PoapClient property can solve the issue, like:
export class PoapClient extends PoapQueryClient implements PoapInterface {
override client: SigningCosmWasmClient;
sender: string;
override contractAddress: string;
methods...
}hi @dadamu are do you happen to have a method of the same name in both your ExecuteMsg and QueryMsg?
@pyramation No, they don't have the same name, the example contract is here.
However PoapClient and PoapQueryClient has the same name properties generated by ts-codegen, client and contractAddress. I added override manually then solved the issue.
I will look into making an option for this.
In the meantime, it looks like you can also set noImplicitOverride to false in your tsconfig.json
tracking here #79
just create a new option client.noImplicit.noImplicitOverride you can set to true.
Defaults to false to keep backwards compat for now.
Successfully published:
- @cosmwasm/ts-codegen@0.21.0
- wasm-ast-types@0.15.0
@pyramation Thanks for the help!