- Install yarn using the MSI OR chocolatey/homebrew, e.g
cinst yarn
yarn global add typescript
(optional, can also install locally below)
- Made directory p5ts
cd p5ts
yarn add @types/p5 --dev
// if you want to do local typescript, add that heremkdir dist
touch dist/index.html
mkdir src
touch src/index.ts
tsc --init
- Open tsconfig.json in editor and change module to
es6
, flag onallowJs
and setoutDir
to./dist
git init
touch .gitignore
- open .gitignore and add
node_modules
touch src/global.d.ts
- Open global.d.ts and include text:
(code retreived from https://github.com/Gaweph/p5-typescript-starter/blob/master/global.d.ts)
import module = require('p5'); import * as p5Global from 'p5/global' export = module; export as namespace p5; declare global { interface Window { p5: typeof module, } }