Comment on page
When the file
tsconfig.jsonis present in the root folder of your app, the Homey CLI will default to TypeScript when running
homey app driver create. If you want to avoid this, remove or rename
Removing or remaning the
tsconfig.jsonfile will also prevent the TypeScript compiler from being invoked when running/installing/publishing your app.
homey app createin your terminal and answer 'Yes' when the CLI asks you to initialize your app with TypeScript utilities. All necessary and recommended dependencies and files will be created for you.
The first thing to do is adding a file named
.tsconfig.jsonto the root folder of your App. This will make Homey recognize your app as a TypeScript app. You are free to configure
tsconfig.jsonto your liking. Only exception being the
outDirwhich should remain
sourceMap: trueis strongly recommended.
Make sure you have the file
.tsconfig.jsonpresent in the root folder of your app. Then run the following command to install all necessary dependencies.
homey app add-types
Rename app.js to app.ts and add the following lines at the top (You can remove
import sourceMapSupport from 'source-map-support';
Add a TypeScript transpile step in the npm
Now you're all set! Run your app with
homey app run. If you performed all steps correctly, then you should see a
Compiling TypeScript...prompt before your app is being run.