March 15, 2020

Typescript function parameter Types

Defining a wrapper function with the same parameters as the inner function.

import { spawn } from 'child_process';

function customSpawn(...options: Parameters<typeof spawn>) {
  console.log('some custom code');
  
  return spawn(...options);
}

References:


typescript


Previous post
Debugging web applications in vscode
Next post
Debug when stdout and stderr not available