Peter Peter - 4 months ago 56
TypeScript Question

Angular2 @types/sharepoint/index.d.ts' is not a module

I'm using Angular 2 in SharePoint

I'm building a service that needs to call Sharepoint via csom and rest and I have run into trouble with the typing for Sharepoint 2013

I have run

npm install @types/sharepoint --save-dev
and am now trying to reference the sharepoint types in my TypeScript code

when I import
import * as sharepoint from 'sharepoint';
I get the error
@types/sharepoint/index.d.ts' is not a module

I don't know how to fix this.

On a side note, doing the exact same thing with the D3 library throws no error i.e.

npm install @types/d3 --save-dev

import * as d3 from 'd3';

works just fine


You do not import typings.

If you can import from 'd3' without any compilation errors then your library folder must have a reference to 'd3' notably ./node_modules/d3.

Some Info on typings is that it guides the compiler as it generates JavaScript files. Additionally, it gives you type checking at design which is a huge benefit to javascript.

you can check if there are modules for sharepoint Here is what i found :