Как загрузить и запустить машинопись вручную внутри другого процесса узла? - PullRequest
0 голосов
/ 24 января 2019

Я пытаюсь запустить мастер-скрипт шаблона команды, который принимает аргументы, которые определяют, когда будут выполняться некоторые другие сценарии.EG

$ ts-node master.ts 01-01-19

выполнит файл 01-01-19.ts.Теперь я пытаюсь выяснить, как выполнить команду вручную, поэтому у меня есть

require("ts-node").register()
require(join(__dirname,'scripts', date +'.ts')).run();

, но вывод, который я получаю,

scripts/01-01-19.ts(1,21): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
scripts/01-01-19.ts(1,29): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
scripts/01-01-19.ts(1,61): error TS7006: Parameter 'mod' implicitly has an 'any' type.
scripts/01-01-19.ts(4,81): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
scripts/01-01-19.ts(5,5): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
scripts/01-01-19.ts(8,24): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
scripts/01-01-19.ts(8,32): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
scripts/01-01-19.ts(8,67): error TS7006: Parameter 'mod' implicitly has an 'any' type.
scripts/01-01-19.ts(16,21): error TS2304: Cannot find name 'define'.
scripts/01-01-19.ts(16,46): error TS2304: Cannot find name 'define'.
scripts/01-01-19.ts(17,9): error TS2304: Cannot find name 'define'.
scripts/01-01-19.ts(19,14): error TS7006: Parameter 'require' implicitly has an 'any' type.
scripts/01-01-19.ts(19,23): error TS7006: Parameter 'exports' implicitly has an 'any' type.
scripts/01-01-19.ts(32,36): error TS7006: Parameter 'line' implicitly has an 'any' type.

ПРИМЕЧАНИЕ. Я не ищуСуществует ли сложное решение, почему я получаю эту ошибку?

...