Open draylegend opened 4 months ago
Planned to publish it to npm @pengu.lol/types
or @types/pengu
. Pengu TS core is currently using global implicit typed via plugins/src/types.d.ts
. It's easy to support both two cases, but implicit typed entry points could not be possible.
Explicit exported module/namespace:
import type { InitFn } from '@pengu.lol/types'
export const init: InitFn = ctx => { /*...*/ }
Global implicit, like vite/client does:
/// <reference types="pengu/global" />
Or using tsconfig.json
:
"typeRoots": ["pengu/global"]
Idea
I need types for life cycle hooks (entry points) like
init
orload
. As far as I know there're two ways to get typesafety with typescript:'pengu-loader'
. In this case the package should be published on npmjs orExplicit
Exported interfaces from
'pengu-loader'
Interfaces that can be exported from
'pengu-loader'
, tooUsage
Implicit
At this point we need some dev server running in the background that generates interfaces silently. I think about vite.
Usage
Obviously the first option is way simpler than the second one.
It'd be great to get some feedback, whether that fits the philosophy etc. or not.