Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
130
rated 0 times [  133] [ 3]  / answers: 1 / hits: 21493  / 7 Years ago, wed, march 22, 2017, 12:00:00

I didn't find a declaration file for 'google-spreadsheet' so I'm trying to create one by myself:



in typings -> modules, I've added a new folder named google-spreadsheet, and there I've added a new file named index.d.ts which has the following content:



export class GoogleSpreadsheet {

}


In the client file I have this:



import * as GoogleSpreadsheet from 'google-spreadsheet';


But 'google-spreadsheet' is marked with red, saying:




TS2307 Cannot find module 'google-spreadsheet'.




BTW I've NPM-installed 'google-spreadsheet' and it works JavaScriptly. Only the TypeScript bothers me here.



Any ideas how to solve that?


More From » node.js

 Answers
9

If you dont need to care about the typings inside this module you can only create a *.d.ts file and put the following content (e.g. create a typings.d.ts):



declare module 'google-spreadsheet';


To define the types inside the module you can change the above code to:



declare module 'google-spreadsheet' {
// define the types...
}

[#58430] Tuesday, March 21, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
benitoh

Total Points: 150
Total Questions: 113
Total Answers: 104

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
benitoh questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;