Overwolf

Overwolf

  • Getting Started
  • Docs
  • API
  • Events Status
  • Blog
  • Q&A
  • Support

›Best Practices

Best Practices

  • Overview
  • App specific experience
  • First time user experience
  • App launch performance
  • Marketing Communications
  • User journey and error handling
  • Per-game settings
  • Hotkey best practices
  • Second monitor usage
  • Data persistence
  • Reduce OPK size
  • Use Tab as an app Hotkey
  • Type definition file
  • Download Link with referral ID
  • Video capture best practices
  • Enable Developer Tools

Using Windows API

  • Using Overwolf windows
  • Windows Communication
  • Windows Types
  • Resolution Size and Position
  • General Tips

Using Plugins

  • Plugins overview
  • Plug-in Implementation
  • Write your own plugin
  • Sample plugin
  • Simple I/O plugin
  • TeamSpeak plugin
  • Downloader plugin
  • Process Manager plugin

Using Events

  • JavaScript events overview
  • Using game events in your app
  • Game events Simulator
  • Verifying event status

Developers Console

  • Submit a new version
  • Submit for review
  • Update store listing
  • Manage your subscriptions
  • Users and permissions
  • Crash reports
  • Rating and reviews

Integrations

  • Integrating app analytics
  • Login with Twitch
  • Login with Overwolf
  • Event SDK for Game Devs
  • Twitch Extensions

Request a Service

  • Marketing asset requirements
  • Looking for Group
  • Promoting your app

Community Help

  • Join the Community
  • Webinars
  • Developers Content
  • Code snippets

Legal

  • Legal overview
  • App terms
  • Developers terms
Edit

Overwolf Type definition file

important

Even if your application not uses TypeScript at all, you can use the type definition files for autocompletion and documentation purposes. More details here.

You can find the Overwolf API ts definition file here

If you are working with Typescript, you can install it as a npm package.

TypeScript overview

TypeScript is a superset of JavaScript which adds optional static typing to the language, hence its name. Static typing enables the compiler to check that operations performed on variables are legal. Those checks prevent you from attempting to invoke a number as a function, for example.

TypeScript can help us to avoid painful bugs that developers commonly run into when writing JavaScript by type-checking the code. It reduces bugs like null handling, undefined, etc. Strongly typed characteristics restrict developers to write type-specific code with proper checks.

In order for TypeScript to perform the type checking, the types need to be defined somewhere. It's pretty straightforward how to add type definitions to the variables declared in your own code:

//  anyObject hold values of any arbitrary type
var anyObject: any;

// count is a number
var count: number;


// regexPatterns is an array of regular expressions
var regexPatterns: RegExp[];

// reverse is a function which accepts and returns a string
var reverse: (input: string) => string;

but how does TypeScript know about the types of variables and functions of existing JavaScript libraries? This is where type definition files come into play.

TypeScript definition files overview

Type definition files allow you to provide type information for JavaScript code that is by itself (by its very nature) not statically typed. The file extension for such a file is “d.ts”, where d stands for definition. Type definition files make it possible to enjoy the benefits of type checking, autocompletion, and member documentation.

Using overwolf.d.ts file

Even if your application uses plain JavaScript and no TypeScript at all, you can use the type definition file for autocompletion and documentation purposes. Simply include it in your Visual Studio Code project. VS will then include the found types in its auto-completion list, given that you've got TypeScript installed:

alt-text

Of course, you won't get the benefit of type checking because you're not actually using TypeScript, but still, the provided information can be very helpful for working with the dynamic and loosely typed language that is JavaScript.

Using types for games events

To make your lives easier when working with our games events API, We've expanded our library with typedef files for the different in-game events. We added Type definition files for each game, for autocompletion and documentation purposes.

You can find the game's events definition files under the same repo and npm package above, under the GEP folder.

VS will then include the found types in its auto-completion list, given that you've got TypeScript installed.

Here is an example for Valorant:

alt-text

Last updated on 2020-10-13 by eransharv
← Use Tab as an app HotkeyDownload Link with referral ID →
  • TypeScript overview
  • TypeScript definition files overview
  • Using overwolf.d.ts file
  • Using types for games events
  • Legal
  • Terms overview
  • Developer's terms
  • App terms
  • Overwolf terms
  • Overwolf Privacy policy
  • Support
  • Questions and Answers
  • Discord
  • Slack
  • Facebook
  • Twitter
  • Documentation
  • Changelog
  • API
  • App Creation Process
  • Best Practices
  • Game Events status
  • Information
  • Careers
  • Fund
  • Developers Blog
  • Overwolf Appstore
  • Advertise on Overwolf