javascript - The property 'xyz' does not exist on value of [imported] type 'xyz' in Typescript -


i accessing functions of imported nodejs module in typescript, , compiler spews given error each method call or property access. declaration:

 import imageproc = module('imageproc'); 

where imageproc compiled c++ node module no typescript definitions.

and call:

 var result:nodebuffer = imageproc.blur(input, 5, 15, 8); 

is there way to:

  1. strongly type imageproc var , define methods provides, or
  2. disable error imageproc var

compilation works fine, said error populates error log making difficult separate legitimate errors false positives.

i'm using vs 2012 web essential 2012 , typescript 0.9.0.1.

if can, first thing should update typescript package, 0.9 outdated.


without getting complicated, defining imageproc any have ts ignore type.

var imageproc: = require('imageproc'); 

another way create placeholder definition file.

create file named imageproc.d.ts with:

declare var imageproc: any; declare module "imageproc" {     export = imageproc; } 

then import as:

import imageproc = require('imageproc'); 

or es6 syntax like:

import * imageproc 'imageproc'; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -