How to declare a module with simple one-file project

45 views Asked by At

I am trying to import my library like so:

import jsonStdio = require('json-stdio');

I am getting this error: TS7016 - enter image description here

The library in question is here: https://github.com/ORESoftware/json-stdio/blob/master/index.ts

does anyone know how I can properly create a module so that it can imported using import x = require('x') syntax with TS?

1

There are 1 answers

0
AudioBubble On

Ahh, all I had to do was add the package.json file for the json-stdio project:

  "typings": "index.d.ts",
  "types": "index.d.ts",

if there is a better/different way to do it, someone please let me know, but because I missing one of those lines (I always add both, just because), then it didn't recognized my .d.ts / declaration file in my json-stdio project.