Skip to content

Commit

Permalink
refactor(types): sync components types
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode authored Jun 1, 2024
1 parent b298e53 commit a9bf8df
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/apis/network/request/request.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sidebar_label: request
| referrerStrategy | `keyof ReferrerStrategy` | `"querystring"` | 否 | referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。<br />API 支持度: alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1<br />[参考地址](https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) |
| success | `(result: SuccessCallbackResult<T>) => void` | | 否 | 接口调用成功的回调函数 |
| fail | `(res: TaroGeneral.CallbackResult) => void` | | 否 | 接口调用失败的回调函数 |
| complete | `(res: TaroGeneral.CallbackResult) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
| complete | `(res: any) => void` | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
| jsonp | string or boolean | `false` | 否 | 设置是否使用 jsonp 方式获取数据<br />API 支持度: h5 |
| jsonpCache | `RequestCache` | | 否 | 设置 jsonp 请求 url 是否需要被缓存<br />API 支持度: h5 |
| mode | `keyof CorsMode` | `"same-origin"` | 否 | 设置是否允许跨域请求<br />API 支持度: h5 |
Expand Down
2 changes: 1 addition & 1 deletion docs/components/media/video.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default class PageView extends Component {
| VideoProps.onPause | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ |
| VideoProps.onEnded | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ |
| VideoProps.onTimeUpdate | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ |
| VideoProps.onFullscreenChange | | | ✔️ | | | | ✔️ | ✔️ | | ✔️ |
| VideoProps.onFullscreenChange | | | | | | | ✔️ | ✔️ | | ✔️ |
| VideoProps.onWaiting | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | | | |
| VideoProps.onError | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ |
| VideoProps.onProgress | ✔️ | | | ✔️ | ✔️ | | ✔️ | | | ✔️ |
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components/types/Video.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ interface VideoProps extends StandardProps {
onTimeUpdate?: CommonEventFunction<VideoProps.onTimeUpdateEventDetail>
/** 当视频进入和退出全屏时触发
*
* @supported alipay, h5, rn, harmony_hybrid
* @supported h5, rn, harmony_hybrid
*/
onFullscreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
/** 视频出现缓冲时触发
Expand Down
2 changes: 1 addition & 1 deletion packages/taro/types/api/network/request.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ declare module '../../index' {
/** 接口调用失败的回调函数 */
fail?: (res: TaroGeneral.CallbackResult) => void
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: (res: TaroGeneral.CallbackResult) => void
complete?: (res: Partial<SuccessCallbackResult> & TaroGeneral.CallbackResult) => void
/** 设置是否使用 jsonp 方式获取数据
* @default false
* @supported h5
Expand Down
1 change: 1 addition & 0 deletions packages/taro/types/compile/config/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './h5'
export * from './mini'
export * from './rn'

export * from './manifest'
export * from './project'
Expand Down
21 changes: 21 additions & 0 deletions packages/taro/types/compile/config/rn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type Webpack from 'webpack'
import type Chain from 'webpack-chain'
import type webpackDevServer from 'webpack-dev-server'
import type HtmlWebpackPlugin from 'html-webpack-plugin'
import type { RollupOptions } from 'rollup'
import type { IOption, IPostcssOption } from './util'

export interface IRNConfig {
Expand Down Expand Up @@ -61,4 +62,24 @@ export interface IRNConfig {

/** 设计稿尺寸换算规则 */
deviceRatio?: TaroGeneral.TDeviceRatio

/** 原生组件编译配置 */
nativeComponents?: {
/**
* 外部依赖
*/
external?: Array<string | RegExp> | ((arr: Array<string | RegExp>) => Array<string | RegExp>)
/**
* 设置外部依赖,如果返回 string, 则将该值作为 external, 我们默认将 node_modules 路径下的文件设置为外部依赖
*/
exteranlResolve?: (importee: string, importer: string) => string
/**
* 组件输出路径,默认值为 'dist'
*/
output?: string
/**
* 修改 Rollup 打包配置
*/
modifyRollupConfig?: (config: RollupOptions, innerPlugins: { taroResolver: typeof taroResolver, styleTransformer: typeof styleTransformer }) => RollupOptions
}
}

0 comments on commit a9bf8df

Please sign in to comment.