stephenh / ts-poet

A code generator DSL for typescript
Apache License 2.0
103 stars 13 forks source link

Property 'toStringWithImports' does not exist on type 'Code'. #52

Closed ws-gregm closed 1 year ago

ws-gregm commented 1 year ago

Rolling through the example in the README and this happens

@ws-gregm ➜ .../tools-workspaces/grpc-poc-server/src/bin (staging) $ ts-node gen

TSError: ⨯ Unable to compile TypeScript:
gen.ts:28:24 - error TS2339: Property 'toStringWithImports' does not exist on type 'Code'.

28 const output = greeter.toStringWithImports("Greeter");
                          ~~~~~~~~~~~~~~~~~~~

    at createTSError (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (/workspaces/tools-workspaces/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  diagnosticCodes: [ 2339 ]
}
stephenh commented 1 year ago

Ah yeah, the toStringWithImports is an older method that was removed, and replaced with just toString, but the readme hadn't been updated. Sorry about that, just pushed a fix. Thanks!