Use forms with or without client-side JavaScript--no code duplication required!
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

27 righe
729 B

  1. import { NextPage as DefaultNextPage } from 'next/types';
  2. import { NextApiRequest, NextApiResponse } from '../common';
  3. export const FormDerivedElementComponent = 'form' as const;
  4. export type FormDerivedElement = HTMLElementTagNameMap[typeof FormDerivedElementComponent];
  5. export const ALLOWED_SERVER_METHODS = ['get', 'post'] as const;
  6. export type AllowedServerMethod = typeof ALLOWED_SERVER_METHODS[number];
  7. export const ALLOWED_CLIENT_METHODS = [
  8. ...ALLOWED_SERVER_METHODS,
  9. 'put',
  10. 'patch',
  11. 'delete',
  12. ] as const;
  13. export type AllowedClientMethod = typeof ALLOWED_CLIENT_METHODS[number];
  14. export type NextPage<T = NonNullable<unknown>, U = T> = DefaultNextPage<
  15. T & {
  16. res: NextApiResponse;
  17. req: NextApiRequest;
  18. }, U
  19. >