Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
The "original" argument must be of type function. Received an instance of Object

I used to have this:

const util = require('util');
const exec = util.promisify(require('child_process').exec);

Then I refactored to this (or at least my attempt to here):

import * as exec from 'child_process';
const execPromise = util.promisify(exec);

Now I am getting the error TypeError: The "original" argument must be of type function. Received an instance of Object on the exec in util.promisify

Not sure how to quite get this working like it was but with this new import syntax for Typescript (specifically related to `@typescript-eslint/no-var-requires

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You're looking for

import { exec } from 'child_process';
const execPromise = util.promisify(exec);

The * as exec did import the whole child_process module into a module namespace object.

about 4 years ago · Santiago Trujillo Relatório

0

Try this...

import * as childProcess from 'child_process';
const execPromise = util.promisify(childProcess.exec);
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda