npm - Actual imported file when I specified an module in node_modules written in Typescript. -


i made typescript module(named modulea). i'd publish package , want use typescript project.

for present, installed 'modulea' 'npm install ../modulea' since test. , these file must placed below.

b   node_modules     modulea       dist         index.ts 

as can see, there directory dist in root directory of modulea. want import index.ts typescript below. import 'modulea';

if there index.ts inside of modulea folder, work. , if javascript file, can write main property of package.json.

however, in case, want use typescript directly , don't want put index.ts out of dist folder.

and don't want make index.ts this.

import d './dist/index'; export default d; 

because there several folders in dist, , i'd reference them project depends on modulea.

is there way specify default typescript file of package?

there option typescript specify in package.json. property of "typings" worked fine me. reference below. https://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html

when specified definition file property, file loaded definition. but, required me remember use "main" property also. cuz, typings definition use in compiling time. , instance of code in javascript specified in "main" property.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -