This message was deleted.
# typescript
s
This message was deleted.
l
How are you importing the provider and instantiating it?
g
@little-cartoon-10569 Like this:
Copy code
import {MyResource} from 'my-module/myprovider';

;; ...

const myResource = new MyResource(..., ...);
l
You're invoking it with a
new
, so the error message makes no sense to me. Are you exporting a default?
g
This is how I define my resource class in the module:
Copy code
export class MyResource extends pulumi.dynamic.Resource {
    constructor(name: string, args: ...) {
         super(myProvider, name, args);
    }
}
What I found on the net is that this issue might occur when a class compiled to ES6 is extended by code that is then compiled to ES5. But I have es2016 in the target in tsconfig.json in both - the module and the pulumi program
When I look at the js sources compiled from ts sources, in my case it’s actually the opposite: the code creating MyResource instance in the pulumi program uses new MyResource, but in the module transpiled from ts to js, it does
_super.call(…)
instead of
new Resource
.