Description
Consider importing an untyped module, eg. exceljs:
import exceljs = require('exceljs');
This results in an error that the module exceljs is not found. There is at least two ways to fix this:
- Setting
allowJs: true
andmaxNodeModulesJsDepth: 1
- Declare an ambient module in a separate file
I think it would be better if instead we update module resolution semantics such that when we find an appropriate package.json without a typings entry, we store it away. Then if module resolution fails (ie. we also can't find an @types/exceljs), we go back and import the untyped package.json as a JS import. Thoughts?
You might argue that this should only be allowed with --allowJs, but it might also make sense to just always use this behavior when using node resolution rules as you may still not want to allow JS in your own project while still allowing your dependencies to be authored in JS without typings.