Typescript definitions for the Roll20 API
The state variable has been set up in such a way that you can extend it's definition to help provide you with type completion. This is thanks to the fact that TypeScript merges duplicate interface definitions as long as they are in the same namespace.
As such, all you need to do is add the following to your script
interface State {
ScriptName: YourObjectDefinition
}
The object definition could be inline or it's own interface. You can see an example of an inline definition below
interface State {
ScriptName: {
property1: number,
property2: string
}
}
Examples of using these typings can be found in the following repos: