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

This module should not be used in runtime. Instead, use a transformer during compilation. #101

Open
ekiwi111 opened this issue May 19, 2021 · 0 comments

Comments

@ekiwi111
Copy link

ekiwi111 commented May 19, 2021

I'm trying to make typescript-is work in a Lambda runtime. Lambda is deployed with AWS CDK.

cdk.json:

{
  "app": "npx ts-node --compiler ttypescript --prefer-ts-exts index.ts",
}

package.json:

"devDependencies": {
    ...
    "ttypescript": "^1.5.12",
    "typescript": "~4.2.4",
    ...
}
"dependencies": {
    ...
    "typescript-is": "^0.18.2",
    ...
}

tsconfig.:

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": ["es2018", "DOM"],
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "typeRoots": ["./node_modules/@types"],
    "baseUrl": "./",
    "plugins": [{
      "transform": "typescript-is/lib/transform-inline/transformer"
    }],
  },
  "exclude": ["cdk.out"]
}

Adding "verbose": true to plugins confirms that transformer is working. When the function is invoked it throws an error with the following stack:

"Error: This module should not be used in runtime. Instead, use a transformer during compilation.",
        "    at checkGetErrorObject (/var/task/index.js:33115:13)",
        "    at is2 (/var/task/index.js:33179:5)",
        ...

Would you suggest anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant