Closed
Description
Since the "JS require is alias" PR went in, in JS:
Prerequisite: install shelljs but NOT @types/shelljs.
const sh = require('shelljs') // no types, so `sh` is implicitly any
sh.config.fatal = true // assignment is interpreted as assignment declaration
sh.exec('npm pack') // `sh` is no longer properly `any`, so error that `exec` is not found.
Expected behavior:
No error, like typescript:
import sh = require('shelljs')
sh.config.fatal = true // ok, whatever, it's any
sh.exec('npm pack') // still any!
Actual behavior:
Property exec
doesn't exist on type typeof shell
.
Workaround:
Install @types/shelljs
.
The best probable fix is to disable assignment declarations to JS aliases. It doesn't make sense to me. However, this might not happen enough to be worth fixing.