I have this code: ```return pulumi.all([this.vpc.p...
# typescript
l
I have this code:
Copy code
return pulumi.all([this.vpc.publicSubnets, this.vpc.privateSubnets, this.vpc.isolatedSubnets]).apply(([pub, pri, iso]) => {
  // ...
});
That's all good in VSCode, Pulumi CLI, and Mocha (when called from VSCode's Test Explorer). But when I run my tests from the command line, I'm getting implicit-any errors:
Copy code
main/pulumi/resources/Vpc.ts:72:108 - error TS7031: Binding element 'pub' implicitly has an 'any' type.
72     return pulumi.all([this.vpc.publicSubnets, this.vpc.privateSubnets, this.vpc.isolatedSubnets]).apply(([pub, pri, iso]) => {
What might cause this? My tsconfig.json files are almost identical (the test one has an additional glob in the include section for the test directory), my package.json's scripts.test section is pretty straightforward
Copy code
"scripts": {
    "compile": "tsc",
    "lint": "node_modules/tslint/bin/tslint --project tsconfig.json",
    "prepare": "npm run compile",
    "test": "env TS_NODE_PROJECT=\"tsconfig.test.json\" node --trace-warnings --unhandled-rejections=strict node_modules/mocha/bin/_mocha --config test/mocha/.mocharc.json",
  },
I have no idea what I'm doing wrong...
I never figured out why it was happening. But I stopped it happening by casting the parameter passed to
.apply()
. For example:
Copy code
pulumi.all([this.publicSubnets, this.privateSubnets]).apply([pub, pri]: awsx.ec2.Subnet[][]) => {
  // ...
});
m
AFAIK you need to disable pulumi’s own TS config in order to work with your custom one. https://www.pulumi.com/docs/intro/languages/javascript/#disabling-built-in-typescript-support
hope it unblocks you
@little-cartoon-10569 ^
l
The only difference between my settings and Pulumi's is that I target es2017 instead of es6, but they're not different enough to explain my problem, are they? Plus it was working a few days ago...