Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Types from tsconfig are not available in node apiΒ #55

@KevinMind

Description

@KevinMind

Given:

types.ts

interface Test {
  promise: Promise<any>;
}

tsconfig.json

{
  "compilerOptions": {
    "lib": [
      "es2015",    ],
}

and my usage file test.ts

const data = mock({
  files: [
    [
      path.join(__dirname, 'types.ts'),
      fs.readFileSync(path.join(__dirname, 'types.ts'), 'utf-8')
    ],
  ],
  interfaces: ['Test'],
  output: 'object',
});

I would expect the following interface to work, but I get the error:

Type 'Promise' is not specified in the provided files but is required for property: 'promise'. Please include it.

In the docs we see that 'Interfaces with property references to other complex types ' are supported. since Promise is an other complex types I would assume it would work.

Is there some special configuration for including a tsconfig or do we need to import all type dependencies? or how should we handle such cases. We are currently investigating using this lib for mocking in test and dev environments and will need to support many such use cases such as dom types, react component types, etc.

Please advise :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions