-
-
Notifications
You must be signed in to change notification settings - Fork 772
TypeScript usage
berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘ edited this page Dec 3, 2019
·
6 revisions
puppeteer-extra
and most plugins are written in TS, so you get perfect type support out of the box. :)
If in doubt please use the following tsconfig
(or compare with yours if you run into import issues):
tsconfig.json
:
{
"compilerOptions": {
"outDir": "./dist",
"target": "es2017",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es2015", "es2016", "es2017", "dom"],
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": false,
"noUnusedLocals": true,
"noUnusedParameters": false,
"pretty": true,
"stripInternal": true
},
"include": ["./src/**/*.tsx", "./src/**/*.ts"],
"exclude": ["node_modules", "dist", "./test/**/*.spec.ts"]
}
- Put your
.ts
files in asrc/
subdirectory - The compiled JS files (after running
yarn tsc
) will be indist/
Full example files: