How can I get the path that the application is running with typescript?

Writing data to the application installation directory is generally a bad idea since the user running the app may not have permission to write files to that directory. What you should probably do instead is create the database file at the location returned by app.getPath('userData').


Use app.getAppPath()

Typescript is a superset of javascript so you could do it in the same way you would do it with javascript, though you may want to declare typings, or use other typescript features when you do so.

Example:

const remote = require('remote'), 
      app = remote.require('app');

var basepath = app.getAppPath();

Update - these days you should use:

const app = require('electron').remote.app

To get the app handle for app.getAppPath().