CosmWasm / ts-codegen

Convert your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
https://cosmology.zone/products/ts-codegen
Apache License 2.0
116 stars 28 forks source link

Pedantic eslint complaints #69

Open ethanfrey opened 2 years ago

ethanfrey commented 2 years ago

Got some messages from eslint. Maybe you can adjust for the empty objects we love in Rust.

Code:

export type ExecuteMsg =
  | {
      bond: {};
    }
  | ...

Error message:

  19:11  error  Don't use `{}` as a type. `{}` actually means "any non-nullish value".
- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.
- If you want a type meaning "any value", you probably want `unknown` instead.
- If you want a type meaning "empty object", you probably want `Record<string, never>` instead  @typescript-eslint/ban-types

I just manually updated mine to Record<string, never>

pyramation commented 2 years ago

can you provide a schema for this? Happy to use Record<string, never> or something similar, just need to know what schema produces this.

ethanfrey commented 2 years ago

Here is the section:

  "query": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "QueryMsg",
    "oneOf": [
      {
        "type": "object",
        "required": [
          "config"
        ],
        "properties": {
          "config": {
            "type": "object",
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    ]
  },

Note sure how to upload JSON file here