is there a limitation in typescript with pulumi th...
# typescript
a
is there a limitation in typescript with pulumi that I cannot use
get
? as in
Copy code
export interface IScalerRule {
    get kedaDefinition(): object;
    createSecretAndAuthentication(): pulumi.Resource
}
i'm getting all kinds of errors when I run pulumi preview, and only since I added code using getters:
TSError: ⨯ Unable to compile TypeScript:
keda.ts(8,5): error TS1131: Property or signature expected.
keda.ts(8,9): error TS1005: ';' expected.
keda.ts(8,25): error TS1005: ';' expected.
keda.ts(9,36): error TS1005: ';' expected.
keda.ts(10,1): error TS1128: Declaration or statement expected.
keda.ts(8,5): error TS2304: Cannot find name 'get'.
keda.ts(8,9): error TS2304: Cannot find name 'kedaDefinition'.
keda.ts(8,27): error TS2552: Cannot find name 'object'. Did you mean 'Object'?
keda.ts(9,5): error TS2304: Cannot find name 'createSecretAndAuthentication'.
keda.ts(150,47): error TS2339: Property 'createSecretAndAuthentication' does not exist on type 'IScalerRule'.
keda.ts(151,43): error TS2339: Property 'kedaDefinition' does not exist on type 'IScalerRule'.
VSCode is fine with the code, though.
actually, I can provoke the same error in another code-file by just adding:
Copy code
export interface ITest 
{
    get name(): string;
}
I will work around this for now by converting all the getters into methods, but why is this a problem? is there some setting I can change to allow getters?
l
Is the
get
syntax specific to a particular version? Check which version is defined in your package.json. Also, the default TS configuration uses es2016; was it in there? You might have to override that. See more here: https://www.pulumi.com/docs/intro/languages/javascript/#3-create-tsconfigjson
a
it seems to me that I used the
get and set
syntax 5+ years ago, and tsconfig says only this:
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
also, I'm using VSCode, which in turn honors tsconfig. and VSCode is perfectly happy with the get declarations.
so, I think this is maybe something I should create an issue for
👍 1