This is a TypeScript definition file for the HTML5 version of FMOD Studio (version 2.01.07), which allows the benefits of static type checking and autocompletion for work in fmodstudio.js and TypeScript.
For anyone new to the FMOD Studio API in HTML5 or TypeScript, here is a starter tutorial.
Download the index.d.ts from this repository and drop it where fmodstudio.js is located in your project. Double-check that it is included in your tsconfig.json file. Once it is, the FMOD types should be recognized globally.
const fmod: FMOD = {};
Note: Do not name your FMOD object 'FMOD' since it will clash with the FMOD namespace type definitions.
let outval: any = {};
fmod.Studio_System_Create(outval);
const studioSystem = outval.val as FMOD.StudioSystem;
FMOD constant bit flags have been converted to TypeScript constant enums, so what would normally be:
let flag = fmod.STUDIO_EVENT_CALLBACK_TYPE_TIMELINE_BEAT;
...is now
let flag = FMOD.STUDIO_EVENT_CALLBACK_TYPE.TIMELINE_BEAT;
This allows these enums to serve as static types in TypeScript, while the compiler will convert them to the appropriate number in JavaScript.
A good amount of FMOD type definitions still contain implicit 'any' as its type. As long as this is the case, the TypeScript compiler will throw errors if 'strict' in 'compilerOptions' is set to true in tsconfig.json. Please set this to false for the meantime until the types have been completed.