Skip to content

Generated ts client files misses override modifier #78

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

Closed
dadamu opened this issue Nov 8, 2022 · 6 comments
Closed

Generated ts client files misses override modifier #78

dadamu opened this issue Nov 8, 2022 · 6 comments

Comments

@dadamu
Copy link

dadamu commented Nov 8, 2022

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...
}
@pyramation
Copy link
Collaborator

hi @dadamu are do you happen to have a method of the same name in both your ExecuteMsg and QueryMsg?

@dadamu
Copy link
Author

dadamu commented Nov 9, 2022

@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.

@pyramation
Copy link
Collaborator

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

@pyramation
Copy link
Collaborator

tracking here #79

@pyramation
Copy link
Collaborator

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/[email protected]
 - [email protected]

@dadamu
Copy link
Author

dadamu commented Nov 10, 2022

@pyramation Thanks for the help!

manu0466 added a commit to desmos-labs/contract-utils that referenced this issue Nov 10, 2022
This PR bumps ts codegen to v0.21.1 to solve missing override modifier
in generated ts files issue by
hyperweb-io/ts-codegen#78.

Co-authored-by: Manuel Turetta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants