提交 a56eec30 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

chore(types): 更新生命周期 ts 类型

上级 74258229
......@@ -102,7 +102,7 @@ function resolveEasycom(component, easycom) {
return shared.isString(component) ? easycom : component;
}
// @ts-ignore
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
......
/// <reference types="@dcloudio/types" />
import { capitalize } from '@vue/shared';
import type { ComponentInternalInstance } from '@vue/runtime-core';
import { extend } from '@vue/shared';
......@@ -6,34 +8,8 @@ import { isPlainObject } from '@vue/shared';
import { ref } from 'vue';
import { shallowRef } from 'vue';
declare interface AddToFavoritesContent {
title?: string;
imageUrl?: string;
query?: string;
}
declare interface AddToFavoritesOption {
webviewUrl?: string;
}
declare interface BackPressOption {
from: 'backbutton' | 'navigateBack';
}
export { capitalize }
declare interface CustomShareAppMessage {
title?: string;
path?: string;
imageUrl?: string;
}
declare interface CustomShareTimeline {
title?: string;
query?: string;
imageUrl?: string;
}
export { extend }
export declare function formatAppLog(type: 'log' | 'info' | 'debug' | 'warn' | 'error', filename: string, ...args: unknown[]): void;
......@@ -43,7 +19,8 @@ export declare function formatH5Log(type: keyof Console, filename: string, ...ar
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
export declare function getCurrentSubNVue(): any;
/// <reference types="@dcloudio/types" />
export declare function getCurrentSubNVue(): UniApp.SubNVue;
export declare function getSsrGlobalData(): any;
......@@ -63,83 +40,39 @@ declare function initUtsStaticMethod(async: boolean, opts: ProxyFunctionOptions)
export { isPlainObject }
declare type LaunchOption = LaunchShowOption;
declare interface LaunchShowOption {
path: string;
query: Record<string, string | undefined>;
scene: number;
shareTicket: string;
referrerInfo?: ReferrerInfo;
}
declare interface NavigationBarButtonTapOption {
index: number;
}
declare interface NavigationBarSearchInputChangedOption {
text: string;
}
declare type NavigationBarSearchInputConfirmedOption = NavigationBarSearchInputChangedOption;
declare interface NavigationBarSearchInputFocusChanged {
focus: boolean;
}
export declare const onAddToFavorites: (hook: onAddToFavoritesHook, target?: ComponentInternalInstance | null) => void;
declare type onAddToFavoritesHook = (options: AddToFavoritesOption) => AddToFavoritesContent | void;
declare type onAppShowHook = (options: LaunchShowOption) => void;
export declare const onAddToFavorites: (hook: (options: Page.AddToFavoritesOption) => Page.CustomFavoritesContent, target?: ComponentInternalInstance | null) => void;
export declare const onBackPress: (hook: onBackPressHook, target?: ComponentInternalInstance | null) => void;
export declare const onBackPress: (hook: (options: Page.BackPressOption) => any, target?: ComponentInternalInstance | null) => void;
declare type onBackPressHook = (options: BackPressOption) => boolean | void;
export declare const onError: (hook: onErrorHook, target?: ComponentInternalInstance | null) => void;
declare type onErrorHook = (error: string) => void;
export declare const onError: (hook: (error: string) => void, target?: ComponentInternalInstance | null) => void;
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onInit: (hook: onLoadHook, target?: ComponentInternalInstance | null) => void;
export declare const onLaunch: (hook: onLaunchHook, target?: ComponentInternalInstance | null) => void;
declare type onLaunchHook = (options: LaunchOption) => void;
export declare const onLoad: (hook: onLoadHook, target?: ComponentInternalInstance | null) => void;
declare type onLoadHook = (query: Record<string, string | undefined>) => void;
export declare const onInit: (hook: (query?: AnyObject | undefined) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarButtonTap: (hook: onNavigationBarButtonTapHook, target?: ComponentInternalInstance | null) => void;
export declare const onLaunch: (hook: (options?: App.LaunchShowOption | undefined) => void, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarButtonTapHook = (options: NavigationBarButtonTapOption) => void;
export declare const onLoad: (hook: (query?: AnyObject | undefined) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputChanged: (hook: onNavigationBarSearchInputChangedHook, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarButtonTap: (hook: (options: Page.NavigationBarButtonTapOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputChangedHook = (options: NavigationBarSearchInputChangedOption) => void;
export declare const onNavigationBarSearchInputChanged: (hook: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputConfirmed: (hook: onNavigationBarSearchInputConfirmedHook, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputConfirmedHook = (options: NavigationBarSearchInputConfirmedOption) => void;
export declare const onNavigationBarSearchInputConfirmed: (hook: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => void;
export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => void;
declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void;
export declare const onPageNotFound: (hook: onPageNotFoundHook, target?: ComponentInternalInstance | null) => void;
declare type onPageNotFoundHook = (options: PageNotFoundOption) => void;
export declare const onPageScroll: (hook: onPageScrollHook, target?: ComponentInternalInstance | null) => void;
declare type onPageScrollHook = (options: PageScrollOption) => void;
export declare const onPageNotFound: (hook: (options: App.PageNotFoundOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onPageShowHook = () => void;
export declare const onPageScroll: (hook: (options: Page.PageScrollOption) => void, target?: ComponentInternalInstance | null) => void;
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => void;
......@@ -147,48 +80,26 @@ export declare const onReachBottom: (hook: () => any, target?: ComponentInternal
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => void;
export declare const onResize: (hook: onResizeHook, target?: ComponentInternalInstance | null) => void;
declare type onResizeHook = (options: ResizeOption) => void;
export declare const onResize: (hook: (options: Page.ResizeOption) => void, target?: ComponentInternalInstance | null) => void;
export declare const onSaveExitState: (hook: onSaveExitStateHook, target?: ComponentInternalInstance | null) => void;
declare type onSaveExitStateHook = () => SaveExitState;
export declare const onShareAppMessage: (hook: onShareAppMessageHook, target?: ComponentInternalInstance | null) => void;
declare type onShareAppMessageHook = (options: ShareAppMessageOption) => CustomShareAppMessage | void;
export declare const onShareTimeline: (hook: onShareTimelineHook, target?: ComponentInternalInstance | null) => void;
export declare const onShareAppMessage: (hook: (options: Page.ShareAppMessageOption) => Page.CustomShareContent | Promise<Omit<Page.CustomShareContent, "promise">>, target?: ComponentInternalInstance | null) => void;
declare type onShareTimelineHook = () => CustomShareTimeline | void;
export declare const onShareTimeline: (hook: () => Page.ShareTimelineContent, target?: ComponentInternalInstance | null) => void;
export declare const onShow: (hook: onAppShowHook | onPageShowHook, target?: ComponentInternalInstance | null) => void;
export declare const onShow: (hook: ((options?: App.LaunchShowOption | undefined) => void) | (() => void), target?: ComponentInternalInstance | null) => void;
export declare const onTabItemTap: (hook: onTabItemTapHook, target?: ComponentInternalInstance | null) => void;
export declare const onTabItemTap: (hook: (options: Page.TabItemTapOption) => void, target?: ComponentInternalInstance | null) => void;
declare type onTabItemTapHook = (options: TabItemTapOption) => void;
export declare const onThemeChange: (hook: (options: UniApp.OnThemeChangeCallbackResult) => void, target?: ComponentInternalInstance | null) => void;
export declare const onThemeChange: (hook: onThemeChangeHook, target?: ComponentInternalInstance | null) => void;
declare type onThemeChangeHook = (options: ThemeChangeOption) => void;
export declare const onUnhandledRejection: (hook: onUnhandledRejectionHook, target?: ComponentInternalInstance | null) => void;
declare type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void;
export declare const onUnhandledRejection: (hook: (options: UniApp.OnUnhandledRejectionCallbackResult) => void, target?: ComponentInternalInstance | null) => void;
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => void;
declare interface PageNotFoundOption {
path: string;
query: Record<string, string | undefined>;
isEntryPage: boolean;
}
declare interface PageScrollOption {
scrollTop: number;
}
declare interface Parameter {
name: string;
type: string;
......@@ -247,20 +158,8 @@ declare interface ProxyFunctionOptions {
params: Parameter[];
}
declare interface ReferrerInfo {
appId: string;
extraData?: any;
}
export declare function requireNativePlugin(name: string): any;
declare interface ResizeOption {
size: {
windowWidth: number;
windowHeight: number;
};
}
export declare function resolveEasycom(component: unknown, easycom: unknown): unknown;
declare interface SaveExitState {
......@@ -270,29 +169,8 @@ declare interface SaveExitState {
export declare const shallowSsrRef: SSRRef;
declare interface ShareAppMessageOption {
from: 'button' | 'menu' | string;
target: any;
webViewUrl?: string;
}
declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>;
export declare const ssrRef: SSRRef;
declare interface TabItemTapOption {
index: string;
pagePath: string;
text: string;
}
declare interface ThemeChangeOption {
theme: 'dark' | 'light';
}
declare interface UnhandledRejectionOption {
promise: Promise<any>;
reason: string;
}
export { }
......@@ -71,7 +71,7 @@ function resolveEasycom(component, easycom) {
return isString(component) ? easycom : component;
}
// @ts-ignore
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
......
......@@ -31,5 +31,11 @@
"@dcloudio/uni-shared": "3.0.0-alpha-3060820221027004",
"@dcloudio/uni-stat": "3.0.0-alpha-3060820221027004",
"@vue/shared": "3.2.41"
},
"peerDependencies": {
"@dcloudio/types": "^3.0.19"
},
"devDependencies": {
"@dcloudio/types": "^3.0.19"
}
}
/// <reference types="@dcloudio/types" />
import type { ComponentInternalInstance } from '@vue/runtime-core'
// @ts-ignore
import { isInSSRComponentSetup, injectHook, getCurrentInstance } from 'vue'
......@@ -32,133 +34,12 @@ import {
UniLifecycleHooks,
} from '@dcloudio/uni-shared'
interface ReferrerInfo {
appId: string
extraData?: any
}
interface LaunchShowOption {
path: string
query: Record<string, string | undefined>
scene: number
shareTicket: string
referrerInfo?: ReferrerInfo
}
type LaunchOption = LaunchShowOption
type onAppShowHook = (options: LaunchShowOption) => void
type onPageShowHook = () => void
type onLaunchHook = (options: LaunchOption) => void
type onLoadHook = (query: Record<string, string | undefined>) => void
type onInitHook = onLoadHook
type onErrorHook = (error: string) => void
interface ThemeChangeOption {
theme: 'dark' | 'light'
}
type onThemeChangeHook = (options: ThemeChangeOption) => void
interface PageNotFoundOption {
path: string
query: Record<string, string | undefined>
isEntryPage: boolean
}
type onPageNotFoundHook = (options: PageNotFoundOption) => void
interface UnhandledRejectionOption {
promise: Promise<any>
reason: string
}
type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void
interface ResizeOption {
size: {
windowWidth: number
windowHeight: number
}
}
type onResizeHook = (options: ResizeOption) => void
interface BackPressOption {
from: 'backbutton' | 'navigateBack'
}
type onBackPressHook = (options: BackPressOption) => boolean | void
interface PageScrollOption {
scrollTop: number
}
type onPageScrollHook = (options: PageScrollOption) => void
interface TabItemTapOption {
index: string
pagePath: string
text: string
}
type onTabItemTapHook = (options: TabItemTapOption) => void
interface CustomShareTimeline {
title?: string
query?: string
imageUrl?: string
}
type onShareTimelineHook = () => CustomShareTimeline | void
interface AddToFavoritesOption {
webviewUrl?: string
}
interface AddToFavoritesContent {
title?: string
imageUrl?: string
query?: string
}
type onAddToFavoritesHook = (
options: AddToFavoritesOption
) => AddToFavoritesContent | void
interface ShareAppMessageOption {
from: 'button' | 'menu' | string
target: any
webViewUrl?: string
}
interface CustomShareAppMessage {
title?: string
path?: string
imageUrl?: string
}
type onShareAppMessageHook = (
options: ShareAppMessageOption
) => CustomShareAppMessage | void
interface SaveExitState {
data: any
expireTimeStamp: number
}
type onSaveExitStateHook = () => SaveExitState
interface NavigationBarButtonTapOption {
index: number
}
type onNavigationBarButtonTapHook = (
options: NavigationBarButtonTapOption
) => void
interface NavigationBarSearchInputChangedOption {
text: string
}
type onNavigationBarSearchInputChangedHook = (
options: NavigationBarSearchInputChangedOption
) => void
type NavigationBarSearchInputConfirmedOption =
NavigationBarSearchInputChangedOption
type onNavigationBarSearchInputConfirmedHook = (
options: NavigationBarSearchInputConfirmedOption
) => void
interface NavigationBarSearchInputFocusChanged {
focus: boolean
}
......@@ -179,32 +60,48 @@ const createHook =
!isInSSRComponentSetup && injectHook(lifecycle as any, hook, target)
}
export const onShow = /*#__PURE__*/ createHook<onAppShowHook | onPageShowHook>(
ON_SHOW
)
export const onShow = /*#__PURE__*/ createHook<
Required<App.AppInstance>['onShow'] | Required<Page.PageInstance>['onShow']
>(ON_SHOW)
export const onHide = /*#__PURE__*/ createHook(ON_HIDE)
export const onLaunch = /*#__PURE__*/ createHook<onLaunchHook>(ON_LAUNCH)
export const onError = /*#__PURE__*/ createHook<onErrorHook>(ON_ERROR)
export const onLaunch =
/*#__PURE__*/ createHook<Required<App.AppInstance>['onLaunch']>(ON_LAUNCH)
export const onError =
/*#__PURE__*/ createHook<Required<App.AppInstance>['onError']>(ON_ERROR)
export const onThemeChange =
/*#__PURE__*/ createHook<onThemeChangeHook>(ON_THEME_CHANGE)
/*#__PURE__*/ createHook<Required<App.AppInstance>['onThemeChange']>(
ON_THEME_CHANGE
)
export const onPageNotFound =
/*#__PURE__*/ createHook<onPageNotFoundHook>(ON_PAGE_NOT_FOUND)
export const onUnhandledRejection =
/*#__PURE__*/ createHook<onUnhandledRejectionHook>(ON_UNHANDLE_REJECTION)
export const onInit = /*#__PURE__*/ createHook<onInitHook>(ON_INIT)
/*#__PURE__*/ createHook<Required<App.AppInstance>['onPageNotFound']>(
ON_PAGE_NOT_FOUND
)
export const onUnhandledRejection = /*#__PURE__*/ createHook<
Required<App.AppInstance>['onUnhandledRejection']
>(ON_UNHANDLE_REJECTION)
export const onInit =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onInit']>(ON_INIT)
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
export const onLoad = /*#__PURE__*/ createHook<onLoadHook>(ON_LOAD)
export const onLoad =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onLoad']>(ON_LOAD)
export const onReady = /*#__PURE__*/ createHook(ON_READY)
export const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD)
export const onResize = /*#__PURE__*/ createHook<onResizeHook>(ON_RESIZE)
export const onResize =
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onResize']>(ON_RESIZE)
export const onBackPress =
/*#__PURE__*/ createHook<onBackPressHook>(ON_BACK_PRESS)
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onBackPress']>(
ON_BACK_PRESS
)
export const onPageScroll =
/*#__PURE__*/ createHook<onPageScrollHook>(ON_PAGE_SCROLL)
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onPageScroll']>(
ON_PAGE_SCROLL
)
export const onTabItemTap =
/*#__PURE__*/ createHook<onTabItemTapHook>(ON_TAB_ITEM_TAP)
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onTabItemTap']>(
ON_TAB_ITEM_TAP
)
export const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM)
export const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH)
......@@ -212,28 +109,31 @@ export const onSaveExitState =
/*#__PURE__*/ createHook<onSaveExitStateHook>(ON_SAVE_EXIT_STATE)
export const onShareTimeline =
/*#__PURE__*/ createHook<onShareTimelineHook>(ON_SHARE_TIMELINE)
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onShareTimeline']>(
ON_SHARE_TIMELINE
)
export const onAddToFavorites =
/*#__PURE__*/ createHook<onAddToFavoritesHook>(ON_ADD_TO_FAVORITES)
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onAddToFavorites']>(
ON_ADD_TO_FAVORITES
)
export const onShareAppMessage =
/*#__PURE__*/ createHook<onShareAppMessageHook>(ON_SHARE_APP_MESSAGE)
export const onNavigationBarButtonTap =
/*#__PURE__*/ createHook<onNavigationBarButtonTapHook>(
ON_NAVIGATION_BAR_BUTTON_TAP
/*#__PURE__*/ createHook<Required<Page.PageInstance>['onShareAppMessage']>(
ON_SHARE_APP_MESSAGE
)
export const onNavigationBarSearchInputChanged =
/*#__PURE__*/ createHook<onNavigationBarSearchInputChangedHook>(
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
)
export const onNavigationBarButtonTap = /*#__PURE__*/ createHook<
Required<Page.PageInstance>['onNavigationBarButtonTap']
>(ON_NAVIGATION_BAR_BUTTON_TAP)
export const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook<
Required<Page.PageInstance>['onNavigationBarSearchInputChanged']
>(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED)
export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
)
export const onNavigationBarSearchInputConfirmed =
/*#__PURE__*/ createHook<onNavigationBarSearchInputConfirmedHook>(
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
)
export const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook<
Required<Page.PageInstance>['onNavigationBarSearchInputConfirmed']
>(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED)
export const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook<onNavigationBarSearchInputFocusChangedHook>(
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
......
......@@ -6,7 +6,7 @@ importers:
specifiers:
'@babel/core': ^7.17.10
'@babel/preset-env': ^7.16.11
'@dcloudio/types': ^3.0.17
'@dcloudio/types': ^3.0.19
'@dcloudio/uni-api': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-app': 3.0.0-alpha-3060820221027004
'@jest/types': ^27.0.2
......@@ -58,7 +58,7 @@ importers:
devDependencies:
'@babel/core': 7.19.6
'@babel/preset-env': 7.19.4_@babel+core@7.19.6
'@dcloudio/types': 3.0.17
'@dcloudio/types': 3.0.19
'@dcloudio/uni-api': link:packages/uni-api
'@dcloudio/uni-app': link:packages/uni-app
'@jest/types': 27.5.1
......@@ -167,6 +167,7 @@ importers:
packages/uni-app:
specifiers:
'@dcloudio/types': ^3.0.19
'@dcloudio/uni-cloud': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-components': 3.0.0-alpha-3060820221027004
'@dcloudio/uni-i18n': 3.0.0-alpha-3060820221027004
......@@ -182,6 +183,8 @@ importers:
'@dcloudio/uni-shared': link:../uni-shared
'@dcloudio/uni-stat': link:../uni-stat
'@vue/shared': 3.2.41
devDependencies:
'@dcloudio/types': 3.0.19
packages/uni-app-plus:
specifiers:
......@@ -2149,8 +2152,8 @@ packages:
resolution: {integrity: sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==}
dev: true
/@dcloudio/types/3.0.17:
resolution: {integrity: sha512-8Uhejd2zvP9KVsCFPuDOGkfBXAkWyEI4BMjv2Fako6CuEC62YxocMaZCoqr+rN1cI2EVa+jR1np9XBTQyVccYA==}
/@dcloudio/types/3.0.19:
resolution: {integrity: sha512-j5mmKskyAxGa3yD5s+M03mRJu6IjxesHJMsXLB3p4jhd2K8D1aqHB3XDrhwPRauOTrKkQSGF14bp8oQsS2t4tA==}
dev: true
/@esbuild/android-arm/0.15.12:
......@@ -5223,7 +5226,7 @@ packages:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
/graceful-fs/4.2.9:
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/}
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/, tarball: https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz}
dev: true
/has-flag/3.0.0:
......
......@@ -21,10 +21,10 @@ import {
import { expectType } from './'
describe('apiLifecycle', () => {
onLaunch(({ path, query, scene }) => {
expectType<string>(path)
expectType<Record<string, string | undefined>>(query)
expectType<number>(scene)
onLaunch((options) => {
expectType<string>(options!.path)
expectType<Record<string, string | undefined>>(options!.query)
expectType<number>(options!.scene)
})
onError((err) => {
expectType<string>(err)
......@@ -40,15 +40,15 @@ describe('apiLifecycle', () => {
expectType<Promise<any>>(promise)
expectType<string>(reason)
})
onShow(({ path }) => {
expectType<string>(path)
onShow((option) => {
expectType<string>(option!.path)
})
onLoad((options) => {
expectType<string | undefined>(options.a)
expectType<any>(options!.a)
})
onResize(({ size: { windowHeight, windowWidth } }) => {
expectType<number>(windowHeight)
expectType<number>(windowWidth)
onResize((res) => {
expectType<number>(res.size!.windowHeight)
expectType<number>(res.size!.windowWidth)
})
onBackPress(({ from }) => {
expectType<'backbutton' | 'navigateBack'>(from)
......@@ -57,11 +57,10 @@ describe('apiLifecycle', () => {
expectType<number>(scrollTop)
})
onTabItemTap(({ index, pagePath, text }) => {
expectType<string>(index)
expectType<number>(index)
expectType<string>(pagePath)
expectType<string>(text)
})
onShareTimeline(() => {})
onShareTimeline(() => {
return {
title: '',
......@@ -69,7 +68,6 @@ describe('apiLifecycle', () => {
imageUrl: '',
}
})
onAddToFavorites(() => {})
onAddToFavorites(({ webviewUrl }) => {
expectType<string | undefined>(webviewUrl)
return {
......@@ -78,7 +76,6 @@ describe('apiLifecycle', () => {
imageUrl: '',
}
})
onShareAppMessage(() => {})
onShareAppMessage(({ from, target, webViewUrl }) => {
expectType<string>(from)
expectType<any>(target)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册