@just-web/types
@just-web/types
provides type definitions for @just-web
modules.
Install
# npm
npm install @just-web/types
# yarn
yarn add @just-web/types
# pnpm
pnpm install @just-web/types
#rush
rush add -p @just-web/types
definePlugin()
Use this helper function to define a plugin module.
The result should be exported as the default export.
import { definePlugin } from '@just-web/types'
export default definePlugin({
init: async () => []
})
It is strongly typed and should work for most scenarios.
defineInit()
If your plugin adds feature to the app using generics,
currently definePlugin()
does not support that.
Instead, you can use defineInit()
and other individual helpers instead:
import { defineInit } from '@just-web/types'
export default {
init: defineInit(async <N>(ctx: { n: N }) => [{ n }])
}