wollardj / simple-plist

A simple API for interacting with binary and plain text plist data.
MIT License
57 stars 22 forks source link

TypeErrors using Deno #66

Open dnicolson opened 2 years ago

dnicolson commented 2 years ago

Running the following script results in type errors when using Deno:

echo 'import plist from "https://cdn.skypack.dev/simple-plist@1.3.1?dts"' | deno run -

https://github.com/wollardj/simple-plist/pull/65 can potentially fix some of them.

Output ``` Download https://cdn.skypack.dev/-/bplist-creator@v0.1.0-uhPJxULkjhpYU9ABuP4k/dist=es2019,mode=types/index.d.ts Download https://cdn.skypack.dev/error/fs?from=simple-plist error: TS2580 [ERROR]: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. export function parseFile(fileNameOrBuffer: string|Buffer, callback?: CallbackFunction): Promise<[T]> ~~~~~~ at https://cdn.skypack.dev/-/bplist-parser@v0.3.1-3naqCj0n5E5E025gpcI1/dist=es2019,mode=types/bplistParser.d.ts:3:63 TS2580 [ERROR]: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. export declare type StringOrBuffer = string | Buffer; ~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/types.d.ts:3:47 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/parse.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/readFile.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/readFileSync.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeBinaryFile.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'WriteFileOptions'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeBinaryFile.d.ts:2:32 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeBinaryFileSync.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'WriteFileOptions'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeBinaryFileSync.d.ts:2:32 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeFile.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'WriteFileOptions'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeFile.d.ts:2:32 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'PathOrFileDescriptor'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeFileSync.d.ts:2:10 TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'WriteFileOptions'. import { PathOrFileDescriptor, WriteFileOptions } from "/error/fs?from=simple-plist"; ~~~~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/writeFileSync.d.ts:2:32 TS2749 [ERROR]: 'bplistCreator' refers to a value, but is being used as a type here. Did you mean 'typeof bplistCreator'? bplistCreator: bplistCreator; ~~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/index.d.ts:12:20 TS2709 [ERROR]: Cannot use namespace 'bplistParser' as a type. bplistParser: bplistParser; ~~~~~~~~~~~~ at https://cdn.skypack.dev/-/simple-plist@v1.3.1-gYmGC2cAOVyMfIB4vlme/dist=es2019,mode=types/dist/index.d.ts:13:19 Found 15 errors. ```
wollardj commented 2 years ago

I just started using Deno for another project of mine and this exact issue crossed my mind. I'll target https://deno.land/x support for the next release.

wollardj commented 2 years ago

I couldn't quite get skypack to work for me, but esm.sh with v1.4.0 works. Granted I don't know much about either service, but it seems like esm.sh is automatically injecting the node compatibility bits from deno.

image