Closed Jamu2800 closed 1 year ago
This is a ts-node
problem.
ts-node does not load all .d.ts
files by default. You need to:
--files
option to make ts-node load all files.d.ts
file to the include
section of your tsconfig.json
.Reference: https://typestrong.org/ts-node/docs/troubleshooting#missing-types
This problem had two causes. One is a problem with ts-node. The ts-node problem is
Use --files option to make ts-node load all files
The problem could be solved by using. Thank you very much.
The second problem was in the d.ts file. It seems that "export" does not load them. Fixed index.d.ts
declare module 'psd' {
function fromFile(path: string): PSD
type PSD = {
parse(): boolean
tree(): TreePSD
}
type TreePSD = {
get(key: string): any
export(): ExportPSD
root(): TreePSD
isRoot(): boolean
children(): TreePSD[]
hasChildren(): boolean
childless(): boolean
ancestors(): TreePSD
siblings(): TreePSD[]
nextSibling(): TreePSD | undefined
prevSibling(): TreePSD | undefined
hasSiblings(): boolean
onlyChild(): boolean
descendants(): TreePSD[]
subtree(): TreePSD[]
depth(): number
path(): string
}
type ExportPSD = {}
export {
fromFile,
PSD,
TreePSD
}
}
I made a prototype of "psd.d.ts". But it doesn't seem to load correctly into typescript. I need your help.
errors
my project
project dir psd.d.ts
package.json
tsconfig.json