In Figma plugin development with TypeScript, the global figma
variable works exactly the same as in JavaScript - you simply write figma
and access its properties and methods directly[1][3].
The figma
global object is available throughout your main plugin code and can be used identically to JavaScript:
// Works the same in TypeScript as JavaScript
const localCollections = await figma.variables.getLocalVariableCollectionsAsync();
const selection = figma.currentPage.selection;