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:
- strongly type imageproc var , define methods provides, or
- 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
Post a Comment