I'm using an NPM package Constate (https://github.com/diegohaz/constate). In node_modules/constate, it includes several type definition files:
constate/
dist/
ts/
src/
types.d.ts
src/
types.ts
And in Constate's package.json, it has:
"types": "dist/ts/src",
I'm trying to import a type from either types.ts or types.d.ts. I tried:
import { SplitValueFunction } from 'constate/dist/ts/src/types';
import { SplitValueFunction } from 'constate/dist/ts/src/types.d';
import { SplitValueFunction } from 'constate/dist/ts/src/types.d.ts';
import { SplitValueFunction } from 'constate/src/types';
import { SplitValueFunction } from 'constate';
None of these work. What's the proper convention to import types from an NPM module? What's the purpose of the types field in package.json?