weapp-api-typings
Advanced tools
Comparing version
{ | ||
"name": "weapp-api-typings", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "weapp TS api typings", | ||
@@ -5,0 +5,0 @@ "main": "./index.d.ts", |
@@ -9,3 +9,2 @@ // Type definitions for non-npm package Wechat Mini Program - wechat-miniprogram 3.3 | ||
/// <reference path="./lib.wx.app.d.ts" /> | ||
@@ -20,31 +19,25 @@ /// <reference path="./lib.wx.page.d.ts" /> | ||
declare namespace WechatMiniprogram { | ||
type IAnyObject = Record<string, any> | ||
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F | ||
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> } | ||
interface AsyncMethodOptionLike { | ||
success?: (...args: any[]) => void | ||
} | ||
type PromisifySuccessResult< | ||
P, | ||
T extends AsyncMethodOptionLike | ||
> = P extends { success: any } | ||
? void | ||
: P extends { fail: any } | ||
? void | ||
: P extends { complete: any } | ||
? void | ||
: Promise<Parameters<Exclude<T['success'], undefined>>[0]> | ||
type IAnyObject = Record<string, any>; | ||
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F; | ||
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }; | ||
interface AsyncMethodOptionLike { | ||
success?: (...args: any[]) => void; | ||
} | ||
type PromisifySuccessResult<P, T extends AsyncMethodOptionLike> = P extends { | ||
success: any; | ||
} | ||
? void | ||
: P extends { fail: any } | ||
? void | ||
: P extends { complete: any } | ||
? void | ||
: Promise<Parameters<Exclude<T["success"], undefined>>[0]>; | ||
} | ||
declare const wx: WechatMiniprogram.Wx | ||
/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */ | ||
declare function require( | ||
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */ | ||
module: string | ||
): any | ||
declare const wx: WechatMiniprogram.Wx; | ||
/** 引入插件。返回插件通过 `main` 暴露的接口。 */ | ||
declare function requirePlugin( | ||
/** 需要引入的插件的 alias */ | ||
module: string | ||
): any | ||
/** 需要引入的插件的 alias */ | ||
module: string, | ||
): any; | ||
/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)。 | ||
@@ -55,9 +48,2 @@ * | ||
* 最低基础库: `2.11.1` */ | ||
declare function requireMiniProgram(): any | ||
/** 当前模块对象 */ | ||
declare let module: { | ||
/** 模块向外暴露的对象,使用 `require` 引用该模块时可以获取 */ | ||
exports: any | ||
} | ||
/** `module.exports` 的引用 */ | ||
declare let exports: any | ||
declare function requireMiniProgram(): any; |
994314
-0.06%22827
-0.06%