Socket
Socket
Sign inDemoInstall

@mini-types/global

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mini-types/global - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

4

package.json
{
"name": "@mini-types/global",
"version": "2.0.14",
"version": "2.0.15",
"description": "TypeScript declarations for Alipay's mini program.",

@@ -24,3 +24,3 @@ "scripts": {},

},
"gitHead": "affcf3d890c2e6a8f502d878ad4ee5c09cbb0459"
"gitHead": "d2930db37f5e4adabc9f5f2b25eb12a2f98b7c66"
}

@@ -363,2 +363,12 @@ export type UnknownRecord = Record<string, unknown>;

export interface IHasMixin {
/**
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
* 若自定义组件注册时传入了ref以指定组件返回值,则可通过hasMixin('ref')检查到
* @version 基础库 2.8.2 起支持
* @return boolean
*/
hasMixin(mixin: IMixinIdentifier): boolean
}
/**

@@ -573,3 +583,4 @@ * `this` type of life cycle hooks in App.

IElementQuery &
ISelectComponent;
ISelectComponent &
IHasMixin;

@@ -624,2 +635,53 @@ /**

/**
* 传统的组件间代码复用,仅Component的mixins参数支持传入,Mixin参数mixins 则只支持传入Mixin()的返回值
*/
type IMixin4Legacy = Partial<Omit<IComponentOptions<UnknownRecord, UnknownRecord, UnknownRecord, UnknownRecord, []>, 'ref' | 'options' | 'mixins'>>;
/**
* Mixin() 返回值
*/
type IMixinIdentifier = string;
/**
* Mixin构造器参数
*/
type IMixinOptions<
Data,
Props,
Methods,
ExtraThis,
ExtraOptions extends UnknownRecord,
IGlobalMiniProgramExtraThis4Component extends Array<IMixinIdentifier>
> = {
[P in keyof ExtraOptions]: P extends keyof IComponentOptions<
Data,
Props,
Methods,
ExtraOptions,
Mixin
> | 'definitionFilter' | 'mixins'
? unknown
: ExtraOptions[P];
} & Omit<Partial<IComponentOptions<Data, Props, Methods, ExtraOptions, Mixin>>, 'ref' | 'options'> & Partial<{
/**
* 定义段过滤器,用于自定义组件扩展
*/
definitionFilter: IMixinDefinitionFilter,
/**
* 组件间代码复用,用于Mixin()的mixins 只支持传入Mixin()注册生成的返回值。不支持传入 js Object
*/
mixins: Array<IMixinIdentifier>
}> &
ThisType<
IComponentInstance<Data, Props, Methods, ExtraThis, ExtraOptions, Mixin>
>;
type IMixinDefinitionFilter = <T extends IComponentOptions>(
/** 使用该 mixin 的 component/mixin 的定义对象 */
defFields: T,
/** 该 mixin 所使用的 mixin 的 definitionFilter 函数列表 */
definitionFilterArr?: IMixinDefinitionFilter[]
) => void
// 获取 mixins 数组的每一个元素的类型

@@ -737,2 +799,23 @@ type TExtractValuesOfTuple<T extends any[]> = T[keyof T & number];

): void;
/**
* 注册一个 `mixin`,接受一个 `Object` 类型的参数。
*
*/
function Mixin<
Data = {},
Props = {},
Methods = {},
ExtraThis = {},
ExtraOptions extends Record<string, unknown> = {},
Mixin extends IMixinIdentifier[] = IMixinIdentifier[]
>(options: IMixinOptions<
Data,
Props,
Methods,
ExtraThis & IGlobalMiniProgramExtraThis4Component,
ExtraOptions,
Mixin
>): IMixinIdentifier;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc