You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.4 KiB
56 lines
2.4 KiB
|
3 years ago
|
# Wechat Mini Program API Typings
|
||
|
|
|
||
|
|
> [中文版本](./README.md)
|
||
|
|
|
||
|
|
[](https://www.npmjs.com/package/@types/wechat-miniprogram)
|
||
|
|
[](https://www.npmjs.com/package/miniprogram-api-typings)
|
||
|
|
[](https://github.com/wechat-miniprogram/api-typings)
|
||
|
|
[](https://travis-ci.org/wechat-miniprogram/api-typings)
|
||
|
|
|
||
|
|
Type definitions for APIs of Wechat Mini Program in TypeScript
|
||
|
|
|
||
|
|
## Install
|
||
|
|
|
||
|
|
### By DefinitelyTyped
|
||
|
|
```bash
|
||
|
|
npm install @types/wechat-miniprogram
|
||
|
|
```
|
||
|
|
|
||
|
|
or:
|
||
|
|
|
||
|
|
### By standalone npm package
|
||
|
|
```bash
|
||
|
|
npm install miniprogram-api-typings
|
||
|
|
```
|
||
|
|
Manually import it after installed:
|
||
|
|
- `import 'miniprogram-api-typings';`
|
||
|
|
|
||
|
|
Or specify types in typescript config:
|
||
|
|
- 在 `tsconfig.json` 中指定 `types: ["miniprogram-api-typings"]`
|
||
|
|
|
||
|
|
Or reference by [Triple-Slash Directives](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html):
|
||
|
|
- `/// <reference path="node_modules/miniprogram-api-typings/index.d.ts" />`
|
||
|
|
|
||
|
|
## Changelog
|
||
|
|
|
||
|
|
See [CHANGELOG.md](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md) (Chinese only)
|
||
|
|
|
||
|
|
## Contribution
|
||
|
|
|
||
|
|
Definitions of Wechat APIs (`lib.wx.api.d.ts`) are auto-generated together with our [documentations](https://developers.weixin.qq.com/miniprogram/dev/index.html), therefore PRs including that file will __not__ be merged. If you found some APIs defined wrongly, create an issue instead.
|
||
|
|
|
||
|
|
Both PR and issue are welcomed for definitions of pages (`Page`), custom components (`Component`) and other else, since they are written manually. Help us improve this definition if you have any bug reports or suggestions! Thanks for contributing!
|
||
|
|
|
||
|
|
### Contributors
|
||
|
|
|
||
|
|
- [Baran](https://github.com/baranwang)
|
||
|
|
- [MinLiang Zeng](https://github.com/zenml/)
|
||
|
|
|
||
|
|
### Automated tests
|
||
|
|
|
||
|
|
We use [`tsd`](https://github.com/SamVerschueren/tsd) to check if this definition is working properly. All test cases are under folder `test`.
|
||
|
|
|
||
|
|
To perform an automated test, clone this repo, `npm install --save-dev` and `npm test`.
|
||
|
|
|
||
|
|
If you have test case that fails the test, an issue or PR will be great. Strong test case that passes are also welcomed.
|