TS2665

error TS2665: Invalid module name in augmentation. Module ‘gas-local‘ resolves to an untyped module at ‘../node_modules/gas-local/index.js‘, which cannot be augmented.

Broken Code ❌

main.ts
1
2
3
4
declare module "gas-local";
import gas from 'gas-local';

const glib = gas.require('./src');

Fixed Code ✔️

You have to move the shorthand ambient module declaration from a “.ts” file into a “.d.ts” file:

types.d.ts
1
declare module "gas-local";
main.ts
1
2
3
import gas from 'gas-local';

const glib = gas.require('./src');