Skip to content
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

TypeError: transformerFn is not a function #104

Closed
LotuxPunk opened this issue Jun 22, 2023 · 2 comments
Closed

TypeError: transformerFn is not a function #104

LotuxPunk opened this issue Jun 22, 2023 · 2 comments
Labels
invalid This doesn't seem right

Comments

@LotuxPunk
Copy link

LotuxPunk commented Jun 22, 2023

Hello ! I'm trying to use ts-patch to replace ttypescript but I'm facing some issues.

I'm using the first method describe in your documentation:

tspc --build

But unfortunately, I get those logs as a result:

> nx run @icure/typescript-common:build

evalmachine.<anonymous>:118235
              throw e;
              ^
TypeError: transformerFn is not a function
    at tspWrappedFactory (evalmachine.<anonymous>:205:39)
    at evalmachine.<anonymous>:110260:33
    at evalmachine.<anonymous>:110347:61
    at Array.map (<anonymous>)
    at transformNodes (evalmachine.<anonymous>:110347:50)
    at emitJsFileOrBundle (evalmachine.<anonymous>:110945:26)
    at emitSourceFileOrBundle (evalmachine.<anonymous>:110880:7)
    at forEachEmittedFile (evalmachine.<anonymous>:110634:26)
    at emitFiles (evalmachine.<anonymous>:110854:5)
    at emitWorker (evalmachine.<anonymous>:118161:30)
Node.js v18.16.0

My tsconfig.json:

{
  "compilerOptions": {
    // ...
    "outDir": "./dist",
    "lib": ["es2017", "es6", "es5", "dom"],
    "plugins": [
      {
        "transform": "@automapper/classes/transformer-plugin",
        "after": true,
        "modelFileNameSuffix": [
          ".model.ts"
        ]
      }
    ]
  },
  "include": ["./index.ts", "./src/**/*"],
  "exclude": ["dist", "node_modules", "test"],
  "filesGlob": ["./**/*.ts"],
}

Typescript version is 5.1.3, yarn version is 3.6.0 and ts-patch is 3.0.0.

Thanks in advance for your help !

@nonara
Copy link
Owner

nonara commented Jun 22, 2023

I had a look, and I discovered the issue was in the transformer.

I made a PR for the library, which you can track here:

There are more details on what's going on there, also.

As a side note, you'll need to use different config when it gets merged, so be sure to check the example I wrote in the readme

@nonara nonara closed this as completed Jun 22, 2023
@LotuxPunk
Copy link
Author

Thanks very much for the quick fix ! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants