I don't know why but it resolve this issue to replace dist/mjs/index.d.ts to dist/cjs/index.d.ts at package.json#L7 and remove exports: from package.json.
It probably also resolve to separate directories to mjs and types same as any other libraries such as @aws-sdk/client-dynamodb.
Describe the bug
When using Native ESM following TypeScript Official Blog, Onetable cannot resolve type(e.g.
Table
,OneSchema
andEntity
).When cjs:
When esm:
To Reproduce
https://github.com/yamatatsu/reproduction-onetable-unresolve-type
Steps to reproduce the behavior:
npm i
../debug.ts
and you can see no error onschema.foo.bar
."type": "module",
frompackage.json
.Environment (please complete the following information):
Additional context
I found some solutions:
.js
to all imports in*.d.ts
following Official Documentation.dist/mjs/index.d.ts
todist/cjs/index.d.ts
atpackage.json#L7
and removeexports:
frompackage.json
.It probably also resolve to separate directories to
mjs
andtypes
same as any other libraries such as@aws-sdk/client-dynamodb
.