When exporting some values coming from directory-tree, this TypeScript error is thrown:
src/example.ts:3:14 - error TS4023: Exported variable 'getTree' has or is using name 'IObj' from external module "/xxxxx/node_modules/.pnpm/directory-tree@3.4.0/node_modules/directory-tree/index" but cannot be named.
3 export const example = () => {
~~~~~~~
Found 1 error in src/example.ts:3
Code:
import * as dirTree from 'directory-tree'
// or if `esModuleInterop` is `true`:
// import dirTree from 'directory-tree'
export const example = () => {
return dirTree('src')
}
tsconfig (error happens when emitting declarations):
When exporting some values coming from directory-tree, this TypeScript error is thrown:
Code:
tsconfig (error happens when emitting declarations):
I replaced the
IObj
type withRecord
, which is equivalent but included in TypeScript. It fixes the issue.