Files
appium/tsconfig.json
Christopher Hiller 06a605420d feat(appium): generate declaration files (#16597)
* feat(appium): generate declaration files

Configure TS to generate declaration files for `appium` package.

Most of these changes are just types getting added or changed via docstrings; in other places, typechecking has caught problems and I had to refactor code to address them.

- Removed `// @ts-check` pragma from all files in `lib/`, since now `checkJs: true` is in `tsconfig.json`.  It needs to stay in place elsewhere (I think) because only sources in `lib` have declarations generated.
- The `install`, `uninstall`, `update` and `run` functions in the base `ExtensionCommand` class were renamed and prefixed with a `_`; TS does not allow overridden functions with differing signatures.   It no longer exports a default.
- Removed `type` prop of options for `DriverCommand` and `PluginCommand` constructors, respectively (this value is derived from the `ExtensionConfig` `config` parameter instead)
- `AppiumDriver` now extends `DriverCore` instead of `BaseDriver`, since some of its function signatures differ from `BaseDriver`'s.
- Small refactor of `deleteSession` to make typechecker happy.
- `executeCommand` now calls to `BaseDriver` directly if `isUmbrellaCmd` is truthy.  This is one place where inheritance just kind of breaks, since `BaseDriver#executeCommand` returns something entirely different than `AppiumDriver#executeCommand` would otherwise.
- Removed `--delete-dir-on-start` from build command, since it may blast generated declarations.
- Reorganize declarations in `types/`; moved some of them out of `@typedef`s. `types.d.ts` becomes `index.d.ts`
- Note that this contains the declarations for `PluginClass` and `DriverClass`, which correspond to the types of extension "main" classes. This differs from the interfaces provided in `@appium/types` (e.g., `Driver`, `ExternalDriver`) in that these aren't just objects; they are classes with constructors and static members. I may end up moving some of this stuff into `@appium/types`, but I'm not sure how useful it will be.  Will see when I add types to `@appium/fake-driver`.

* chore(appium): remove transpile directives
this was ostensibly for gulp-babel

* chore(appium): remove redundant type declaration

* fix(appium): avoid potential unhandled rejections

- make types more readable

* chore(appium): fix capabilities types

- move `scripts/generate*` elsewhere
- add reference to `@appium/types` in `tsconfig.json`

* chore(appium): review updates for legibility
2022-03-25 14:54:45 -07:00

21 lines
482 B
JSON

{
"exclude": ["packages/**/test/**", "packages/**/build/**"],
"compilerOptions": {
"baseUrl": "./packages",
"paths": {
"@appium/support": ["support"],
"@appium/base-driver": ["base-driver"],
"appium": ["appium"],
"@appium/types": ["types"]
},
"noEmit": true
},
"files": [],
"references": [
{"path": "packages/types"},
{"path": "packages/support"},
{"path": "packages/base-driver"},
{"path": "packages/appium"}
]
}