0

Inside node_modules there is directory:

data/lib/

With files:

index.js
index.ts
Data.js
Data.ts

How to use this module using import?

I have tried:

import import * as d from  'data/lib';

I says that:

`index.d.ts' is not a module

File `index.d.ts' is empty

1 Answer 1

1

You need an index.d.ts beside the index.js. You need to generate a build from your .ts files to be able to import it in other projects. There is a property on tsconfig.json called declaration that you can set to true, and then when you call tsc to generate your build, it will create the .d.ts files automatically for you. Take a look.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.