https://pulumi.com logo
#typescript
Title
# typescript
c

careful-book-62830

12/07/2022, 3:42 PM
Hi Maybe someone is aware: Pulumi ignores my custom typings in
d.ts
files. How to force Pulumi to read these files? Typescript sees them and compiles, but Pulumi doesn’t
l

little-cartoon-10569

12/07/2022, 6:53 PM
Are these files put in a different (output) directory than your normal .ts files? Or are they in the same directory? Pulumi uses ts-node by default, and reads files from the source directory, not the outDir configured in tsconfig.json. If you're putting your .d.ts files in the outDir, alongside .js and .d.ts files transpiled by tsc, then Pulumi won't see them. If this is the case, you can either put your .d.ts files in the source directory, or configure Pulumi not to use ts-node. https://www.pulumi.com/docs/intro/languages/javascript/#disabling-built-in-typescript-support
c

careful-book-62830

12/08/2022, 11:06 AM
Thank you. This works, but need to build app every time before runnig pulumi
l

little-cartoon-10569

12/08/2022, 7:14 PM
You can put the .d.ts files in your source directory, then you won't need to rebuild. Pulumi uses ts-node, which has no transpile step, it runs directly from the .ts files. You need to make your .d.ts files findable for ts-node.
c

careful-book-62830

12/13/2022, 6:03 PM
it was in there and no luck.
l

little-cartoon-10569

12/13/2022, 8:14 PM
Ah. I don't know then. Maybe the ts-node docs explain how to get this working? It's almost certainly not a Pulumi-specific problem, it's about how the auto-transpilation thing in ts-node finds files and makes them available to the JS engine...
2 Views