TypeScript type definitions for Office Scripts.
The Office Scripts runtime environment is a little odd, so we need to generate some type definitions. You need two sets of typings:
excel.d.ts
, which contains the types for the Office Scripts API. Unfortunately this file is not conveniently available.misc.d.ts
, which contains some miscellaneous type definitions that are missing from the standard ES lib files, such asconsole.log
.
The office-scripts-typings
script will take care of this for you.
Run the following command:
npx office-scripts-typings generate [output]
The generated type definitions will be put in the output
directory. The default value is @types/office-scripts
.
Make sure output
is listed in your tsconfig's typeRoots
so the compiler sees them.