问题
I'm developing a Google Apps Script (GAS) using Typescript (via the clasp tool).
I imported type definitions by running npm i -S @types/google-apps-script
.
Some types are quite lengthy, for example:
let sheet: GoogleAppsScript.Spreadsheet.Sheet
Is there a way to define an abbreviation within a file? e.g.,
declare Sheet = GoogleAppsScript.Spreadsheet.Sheet
回答1:
You can define new alias type:
type Sheet = GoogleAppsScript.Spreadsheet.Sheet
来源:https://stackoverflow.com/questions/53198823/abbreviate-lengthy-typescript-types