Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复getCurrentInstance方法类型声明#6904,修复taro update project报错#6850 #6909

Merged
merged 9 commits into from
Jul 8, 2020
4 changes: 2 additions & 2 deletions packages/taro-cli/src/presets/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default (ctx: IPluginContext) => {
const nervJSVersion = `^${await getLatestVersion('nervjs')}`

// 更新 @tarojs/* 版本和 NervJS 版本
Object.keys(packageMap.dependencies).forEach((key) => {
Object.keys(packageMap.dependencies || {}).forEach((key) => {
if (UPDATE_PACKAGE_LIST.indexOf(key) !== -1) {
if (key.includes('nerv')) {
packageMap.dependencies[key] = nervJSVersion
Expand All @@ -102,7 +102,7 @@ export default (ctx: IPluginContext) => {
}
}
})
Object.keys(packageMap.devDependencies).forEach((key) => {
Object.keys(packageMap.devDependencies || {}).forEach((key) => {
if (UPDATE_PACKAGE_LIST.indexOf(key) !== -1) {
if (key.includes('nerv')) {
packageMap.devDependencies[key] = nervJSVersion
Expand Down
4 changes: 3 additions & 1 deletion packages/taro/types/taro.extend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ declare namespace Taro {

function setIsUsingDiff (flag: boolean)

const Current: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还是要保留 Current 的定义:

const Current: Current

不然用户 import Current 时只能得到一个 interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的、那我修改下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复、你看下

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

老哥改成这样咯:

image

不然 Current 的定义重复了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改好了

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

赞~

interface Current {
app: AppInstance | null,
router: RouterInfo | null,
page: PageInstance | null,
onReady: string,
onHide: string,
onShow: string
}

function getCurrentInstance(): Current
}