sk-form-data icon indicating copy to clipboard operation
sk-form-data copied to clipboard

Types not working

Open matiadev opened this issue 2 years ago • 4 comments

I could be wrong but I thought the included types from global.d.ts would give you types.

// node_modules/sk-form-data/global.d.ts

declare namespace App {
  interface Locals {
    form_data: Record<string, any>
  }
}

That doesn't seem to be the case.

// +page.server.ts

import type { Actions } from './$types'

export const actions: Actions = {
  default: async ({ locals }) => {
    locals.form_data // Property 'form_data' does not exist on type 'Locals'. 🤪
  },
}

Do you need to type it yourself inside app.d.ts?

matiadev avatar Feb 12 '23 15:02 matiadev

Very possible be I do personally have it in my App.d.ts. If someone else has a better all but I'll update the readme with info on augmenting your app types.

stolinski avatar Feb 12 '23 17:02 stolinski

I can update the steps in #1 if you agree with the changes.

matiadev avatar Feb 12 '23 18:02 matiadev

Please do so, love the README changes.

stolinski avatar Feb 12 '23 19:02 stolinski

Whoops. Not sure why I closed this. Go ahead and just add it was a 2nd PR. I was a bit premature on the merge.

stolinski avatar Feb 12 '23 19:02 stolinski