Skip to content

How to extend Dispatcher.HttpMethod typescript definition? #2262

Answered by metcoder95
dkatashev asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! You need to augment the RequestOptions interface, not the DispatchOptions one. As follows:

import { request } from 'undici';

declare module 'undici' {
  namespace Dispatcher {
    interface RequestOptions {
      method: HttpMethod | 'MKCOL';
    }
  }
}

request('http://localhost:3000', {
  method: 'MKCOL',
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dkatashev
Comment options

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