Configure miniprogram-api-typings in your project
masterIf you installed the standalone miniprogram-api-typings package, you must tell TypeScript how to use it. You can use any of the following three methods:
- Manual Import: Add an import statement in your entry file.
- tsconfig.json: Add the package to your
typesarray (recommended for global availability). - Triple-slash Directive: Reference the definition file directly in a specific file.
// Method 1: Manual import
import 'miniprogram-api-typings';
// Method 2: In tsconfig.json
// {
// "compilerOptions": {
// "types": ["miniprogram-api-typings"]
// }
// }
// Method 3: Triple-slash directive
/// <reference path="node_modules/miniprogram-api-typings/index.d.ts" />