In my Typescript project, I have these files: - in...
# typescript
l
In my Typescript project, I have these files: • index.ts • service/index.ts The file
service/index.ts
has:
Copy code
export interface DatabaseOptions {
...
}

export class Service extends pulumi.ComponentResource {
...
}
The main
index.ts
file, I has:
Copy code
import * as backend from "./service";

const dbArgs = new backend.DatabaseOptions({
...
})
But I get an error on `DatabaseOptions`:
Copy code
error: Running program '/Users/ringods/Projects/devops-sessions/pulumi/backend' failed with an unhandled exception:
    TSError: ⨯ Unable to compile TypeScript:
    index.ts(13,28): error TS2339: Property 'DatabaseOptions' does not exist on type 'typeof import(/Users/ringods/Projects/devops-sessions/pulumi/backend/service/index")'.
What am I missing here?
m
From your snippet, it looks like you're trying to
new backend.DatabaseOptions
, but
DatabaseOptions
is just an interface, not a class.
I think you want
const dbArgs: backend.DatabaseOptions = { ... };
💯 1