Skip to content

Running into Typescript complaints when trying to create a plugin. #600

Discussion options

You must be logged in to vote

The updated docs are not published yet (it will with Vue 3.2.0), but you need to provide all generics with the exact same name as in the source code. You don't need to provide the default values. There is a full example at https://github.com/posva/pinia/blob/v2/test-dts/customizations.test-d.ts. I plan on creating a few small plugins as examples as well.

BTW, you shouldn't redeclare existing options like actions, state, etc

In your case something like this should do

import 'pinia'

declare module 'pinia' {
    export interface PiniaCustomProperties<Id, S, G, A> {
      // NOTE: I would personally not bother with declaring this option and ignore it in ts since it's an internal property tha…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@posva
Comment options

posva Aug 6, 2021
Maintainer

@joezimjs
Comment options

@posva
Comment options

posva Aug 6, 2021
Maintainer

Answer selected by joezimjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants