#verbatimModuleSyntax + Nest

7 messages · Page 1 of 1 (latest)

austere pike
#

Does anyone know if we can use Nest with verbatimModuleSyntax?
It seems that it would break the DI. See example on TS playground:

import { HttpService } from '@nestjs/axios';
// [...]
class C {
    constructor (private readonly m: HttpService) {}
}

The verbatimModuleSyntax option makes in an error to have this import with no type but if you fix it to import type as it wants, then the thing is decorated with Function instead of HttpService! (see the generated JS output).
I can't find anything about it in the Nest issues. Anyone knows something about it?

fading pecan
fading pecan
#

It must be some other issue, it complains even when it's used as a value:

#

It does not work when you have module set to CommonJS in your tsconfig. Precisely for the reason that is does not transpile it to require - so it would not work in CommonJS environment.

austere pike
#

As far as I remember Nest doesn't work good with esmodules projects right?