swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

Readonly Prop and .d.ts option

Open ofuochi opened this issue 5 years ago • 1 comments

Currently, the plugin does not reflect readonly properties. Also, there should be an option to allow export to .d.ts file

ofuochi avatar Sep 25 '20 08:09 ofuochi

i think you are trying to create an SDK.

So,

  1. Create a new folder
  2. Add the generates types API.ts in src folder
  3. use this tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
    "lib": [
      "dom",
      "es2015",
      "esnext.asynciterable"
    ],
    "sourceMap": true,
    "declaration": true,
    "skipLibCheck": true
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}
  1. In the package.json, add this command to generate the build "build": "rm -rf dist && npx tsc -p tsconfig.json --outDir ./dist"

shrmaky avatar Sep 25 '20 14:09 shrmaky