Skip to content

chore/replace TS types for interfaces#349

Merged
Mortaro merged 1 commit intonullstack:nextfrom
mayconfsousa:chore/replace-ts-types-for-interfaces
May 22, 2023
Merged

chore/replace TS types for interfaces#349
Mortaro merged 1 commit intonullstack:nextfrom
mayconfsousa:chore/replace-ts-types-for-interfaces

Conversation

@mayconfsousa
Copy link
Contributor

@mayconfsousa mayconfsousa commented May 22, 2023

  1. Now we can extend Nullstack types by using module augmentation
// @types/nullstack.d.ts

import 'nullstack'

declare module 'nullstack' {
  interface BaseNullstackClientContext {
    me?: User
  }

  interface BaseNullstackServerContext {
    database: Database
  }

  interface NullstackSecrets {
    anyPrivateKey: string
  }

  interface NullstackSettings {
    anyPublicKey: string
  }

  interface NullstackInstances {
    uploader: Uploader
  }

  interface NullstackRequest {
    me?: User
  }

  interface NullstackResponse {
    me?: User
  }
}
  1. Now we have intellisense for the request and response properties according to the Express types

Screenshot 2023-05-22 at 12 08 20

@Mortaro Mortaro merged commit d0df4ef into nullstack:next May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants