https://pulumi.com logo
Title
l

limited-rainbow-51650

02/03/2020, 10:56 PM
In my Typescript project, I have these files: • index.ts • service/index.ts The file
service/index.ts
has:
export interface DatabaseOptions {
...
}

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

const dbArgs = new backend.DatabaseOptions({
...
})
But I get an error on `DatabaseOptions`:
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

microscopic-pilot-97530

02/03/2020, 11:28 PM
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