Skip to content

Instantly share code, notes, and snippets.

@akrantz
Last active April 23, 2019 11:52
Show Gist options
  • Save akrantz/cd66e0543551e40956a4b1eecf9d5998 to your computer and use it in GitHub Desktop.
Save akrantz/cd66e0543551e40956a4b1eecf9d5998 to your computer and use it in GitHub Desktop.
name: functions - return type (TypeScript)
description: ''
host: EXCEL
api_set: {}
script:
content: |
/**
* @customfunction
*/
function returnsBoolean(): boolean {
return true;
}
/**
* @customfunction
*/
function returnsNumber(): number {
return 5;
}
/**
* @customfunction
*/
function returnsString(): string {
return "abc";
}
/**
* @customfunction
*/
function returnsObject(): object {
return {};
}
/**
* @customfunction
*/
// function returnsArray(): string[] {
// return ["abc"];
// }
/**
* @customfunction
*/
function returnsMatrixAny(): any[][] {
return [[1, "string"]];
}
/**
* @customfunction
*/
function returnsMatrixBoolean(): boolean[][] {
return [[true]];
}
/**
* @customfunction
*/
function returnsMatrixNumber(): number[][] {
return [[5]];
}
/**
* @customfunction
*/
function returnsMatrixNumbers1x3(): number[][] {
return [[1, 2, 3]];
}
/**
* @customfunction
*/
function returnsMatrixNumbers3x1(): number[][] {
return [[1], [2], [3]];
}
/**
* @customfunction
*/
function returnsMatrixNumbers3x3(): number[][] {
return [[1,2,3], [4,5,6], [7,8,9]];
}
/**
* @customfunction
*/
function returnsMatrixString(): string[][] {
return [["abc"]];
}
language: typescript
libraries: |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
@types/office-js
[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css
[email protected]/client/core.min.js
@types/core-js
@microsoft/[email protected]/dist/office.helpers.min.js
@microsoft/[email protected]/dist/office.helpers.d.ts
[email protected]
@types/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment