user7898461
user7898461

Reputation:

How to declare a module with simple one-file project

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?

Upvotes: 0

Views: 47

Answers (1)

user7898461
user7898461

Reputation:

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.

Upvotes: 0

Related Questions