Hi quick question : Any idea why when using typesc...
# typescript
p
Hi quick question : Any idea why when using typescript, Pulumi ignores my configuration in tsconfig.json ? To give more context, I added some typings using
include
. It's working fine with
npx tsc -p tsconfig.json
but with Pulumi it says "Cannot find name"... for all my types.
l
Is your Pulumi project in the same directory as tsconfig.json (or a subdirectory)? Have you configured a non-default Typescript setup (https://www.pulumi.com/docs/intro/languages/javascript/#disabling-built-in-typescript-support)?
p
Thanks for your answer. Actually, yes: Pulumi in inside the same folder of the tsconfig.json file. No non-default typescript setup here (version v3.48.0). I have my monorepo project files and folders, and one folder for "infrastructure" where Pulumi files and custom utils are
message has been deleted
Content of Pulumi.yaml :
Copy code
name: infrastructure
description: A minimal TypeScript Pulumi program
runtime: nodejs
Content of tsconfig.json
Copy code
{
  "compileOnSave": true,
  "compilerOptions": {
    "strict": true,
    "outDir": "bin",
    "target": "es2016",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "experimentalDecorators": true,
    "pretty": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "forceConsistentCasingInFileNames": true
  },
  "files": [
    "index.ts"
  ],
  "include": [
    "typings/*.d.ts"
  ]
}
Actually the weird part is, as an example, if I try to set an invalid "target", I have an error so the file is parsed. It's like if the "include" section would be overwriten
Okay, it's due to how ts-node works VS tsc i'm used to. I had to follow a convention as suggested in https://github.com/TypeStrong/ts-node/issues/782
187 Views