Skip to content

TypeError: transformerFn is not a function #104

Closed

Description

@LotuxPunk

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 !

Activity

  1. nonara commented on Jun 22, 2023

    @nonara
    Owner

    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

  2. LotuxPunk commented on Jun 23, 2023

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions