Skip to content

Commit

Permalink
feat: added getEnvInfoSync typings
Browse files Browse the repository at this point in the history
  • Loading branch information
wenfangdu committed Jun 27, 2023
1 parent 0e76ea1 commit f3ce465
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions packages/taro/types/api/taro.extend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ declare module '../index' {
namespace setGlobalDataPlugin {
/** Vue3 插件,用于设置 `getApp()` 中的全局变量 */
interface Plugin {
install (app: any, data: any): void
install(app: any, data: any): void
}
}

/** @ignore */
/** @ignore */
interface TARO_ENV_TYPE {
[TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP
[TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB
Expand All @@ -56,7 +56,7 @@ declare module '../index' {
type InterceptorifyInterceptor<T, R> = (chain: InterceptorifyChain<T, R>) => Promise<R>
interface Interceptorify<T, R> {
request(requestParams: T): Promise<R>
addInterceptor( interceptor: InterceptorifyInterceptor<T, R>): void
addInterceptor(interceptor: InterceptorifyInterceptor<T, R>): void
cleanInterceptors(): void
}
}
Expand Down Expand Up @@ -101,6 +101,29 @@ declare module '../index' {
*/
getAppInfo(): getAppInfo.AppInfo

getEnvInfoSync(): {
/** 小程序信息 */
microapp: {
/** 小程序版本号 */
mpVersion: string
/** 小程序环境 */
envType: string
/** 小程序appId */
appId: string
}
/** 插件信息 */
plugin: Record<string, unknown>
/** 通用参数 */
common: {
/** 用户数据存储的路径 */
USER_DATA_PATH: string
/** 校验白名单属性中的appInfoLaunchFrom后返回额外信息 */
location: string | undefined
launchFrom: string | undefined
schema: string | undefined
}
}

/** 小程序引用插件 JS 接口
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
*/
Expand Down

0 comments on commit f3ce465

Please sign in to comment.