Closed apexskier closed 4 years ago
How did you write/generate your types (types/nova/index.d.ts)? They're mostly similar to mine, but you've added comments, which are useful. If they aren't maintained by hand I'd like to include them.
I’ve copied them manually from Nova docs
I haven't found any sort of package that provides them without also pulling in the node typings, which I don't want since extensions don't run in a node runtime
That’s the reason why I’ve copied them manually from default TS libs. Nova execution host is neither DOM nor Node.js so the only solution I’ve found is to copy them from defaults and provide exact execution environment for Nova.
Should we figure out how to pull in fetch types into @types/nova-editor? (This will have similar issues to streams)
I don’t think so. Nova has its own execution environment and all common interfaces like fetch
are implemented specifically for editor JS env so it’s better to keep them separately from default libs
Hey there!
I'm the author of Nova editor types on DefinitelyTyped (and the Nova TypeScript extension). As part of trying to make sure they're actually useful, I'm working through applying them to this project (since it also uses typescript), and I'd like to switch this project to using them directly. I've managed to find a few issues with my typings, and am updating them in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46703 (tests will fail until that's published).
You've taken some different approaches than I have, so I've got a few open questions that might help improve the community typings.
types/nova/index.d.ts
)? They're mostly similar to mine, but you've added comments, which are useful. If they aren't maintained by hand I'd like to include them.ReadableStream
andWriteableStream
. These are used byProcess
andfetch
, both of which can be available in the extension runtime. They need to be declared, but I don't really want to copy-paste from the lib dom typings, as you've done. I haven't found any sort of package that provides them without also pulling in the node typings, which I don't want since extensions don't run in a node runtime (it's actually a JavaScriptCore runtime with some extras). In my types, I've just declared them asunknown
, which works as long as they're not used (as they aren't here and in my extension), but I don't like this and feel like it's going to bite someone in future. I don't want to include node types though, as that will definitely bite me, and I've had issues with that in react/react native projects in my real job. Do you have an opinion? Is it okay to leave them unknown (at least for now)? Should we include the stream types you're using in the base package?fetch
types into@types/nova-editor
? (This will have similar issues to streams)