taro-bluetooth-print 2.9.1 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,5 +80,5 @@ export declare class Container {
80
80
  private createInstance;
81
81
  }
82
82
  export declare const rootContainer: Container;
83
- export declare function injectable<T extends Constructor>(constructor: T): T;
83
+ export declare function injectable<T extends Constructor<object>>(constructor: T): T;
84
84
  export declare function inject(token: string | symbol): (target: any, _propertyKey: string | symbol, parameterIndex: number) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taro-bluetooth-print",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "Taro 蓝牙打印库 v2.6 - 轻量级、高性能、跨平台支持微信、支付宝、百度、字节跳动小程序及H5 Web Bluetooth",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -73,15 +73,17 @@ export class Container {
73
73
  const config = provider as ServiceProviderConfig<T>;
74
74
 
75
75
  // 如果是对象语法(Angular 风格)
76
- if (config && typeof config === 'object' && (config.useClass || config.useFactory || config.useValue !== undefined)) {
77
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
- let actualProvider: Provider<any>;
76
+ if (
77
+ config &&
78
+ typeof config === 'object' &&
79
+ (config.useClass || config.useFactory || config.useValue !== undefined)
80
+ ) {
81
+ let actualProvider: Provider<T>;
79
82
 
80
83
  if (config.useClass) {
81
84
  // 使用类 - 创建工厂函数来解析依赖
82
85
  const Cls = config.useClass;
83
86
  actualProvider = (container: Container) => {
84
- // 简化:直接实例化(实际应该解析依赖)
85
87
  return container.createInstance(Cls);
86
88
  };
87
89
  } else if (config.useFactory) {
@@ -91,6 +93,7 @@ export class Container {
91
93
  }
92
94
 
93
95
  const registration: Registration<T> = {
96
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
94
97
  provider: actualProvider,
95
98
  options: {
96
99
  lifecycle: config.lifecycle || 'transient',
@@ -305,11 +308,10 @@ export class Container {
305
308
  export const rootContainer = new Container();
306
309
 
307
310
  // 装饰器辅助函数
308
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
309
- export function injectable<T extends Constructor>(constructor: T): T {
311
+ export function injectable<T extends Constructor<object>>(constructor: T): T {
310
312
  // 标记类为可注入
311
313
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
312
- (constructor as any).__injectable = true;
314
+ (constructor as Constructor & { __injectable: boolean }).__injectable = true;
313
315
  return constructor;
314
316
  }
315
317