Skip to content

error TS7022: '__importDefault' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. #883

@chadarsenault

Description

@chadarsenault

OS: Windows 10 64
Environment: node v10.14.2, ts-node v8.3.0, typescript v3.6.2

I receive this error only while running ts-node as the loader, but not while compiling with typescript directly. I've attached the contents of my project's root\api dir, C:\www\node-framework\api for inspection. The only two files currently being touched by typescript should be C:\www\node-framework\api\src\framework.ts and C:\www\node-framework\api\src\app.ts

Full error:

$ node_modules/.bin/ts-node --require ts-node/register ./src/framework.ts

C:\www\node-framework\api\node_modules\ts-node\src\index.ts:245
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError:  Unable to compile TypeScript:
src/framework.ts:2:5 - error TS7022: '__importDefault' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

2 var __importDefault = (this && this.__importDefault) || function (mod) {
      ~~~~~~~~~~~~~~~
src/framework.ts:2:67 - error TS7006: Parameter 'mod' implicitly has an 'any' type.

2 var __importDefault = (this && this.__importDefault) || function (mod) {
                                                                    ~~~

    at createTSError (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:245:12)
    at reportTSError (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:249:19)
    at getOutput (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:362:34)
    at Object.compile (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:395:32)
    at Module.m._compile (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:473:43)
    at Module.m._compile (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:473:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at require.extensions.(anonymous function) (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:476:12)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\www\node-framework\api\node_modules\ts-node\src\index.ts:476:12)
[www_node-framework_api.zip](https://github.com/TypeStrong/ts-node/files/3588384/www_node-framework_api.zip)

    at Module.load (internal/modules/cjs/loader.js:599:32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions