From c515afdc687e8be517c71ee274bf9339c6467a47 Mon Sep 17 00:00:00 2001 From: Wenzhao Hu Date: Sat, 8 Jul 2023 01:09:21 +0800 Subject: [PATCH] :bug: Fix type error --- package.json | 4 ++-- src/decorators.ts | 4 ++-- src/dependencyIdentifier.ts | 8 ++++---- test/.DS_Store | Bin 0 -> 6148 bytes tsconfig.check.json | 4 ++++ 5 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 test/.DS_Store create mode 100644 tsconfig.check.json diff --git a/package.json b/package.json index 6fb3990..6f32a89 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "$schema": "https://raw.githubusercontent.com/hullis/squirrel/master/src/schema/package.schema.json", "name": "@wendellhu/redi", - "version": "0.6.4", + "version": "0.6.5", "description": "A dependency library for TypeScript and JavaScript, along with a binding for React.", "scripts": { "test": "vitest --coverage", "lint": "eslint --fix 'src/**/*.ts'", "lint:prettier": "prettier --write '{src,test}/**/*.{ts,tsx}'", "build": "squirrel", - "typeCheck": "tsc -p tsconfig.json --noEmit" + "typeCheck": "tsc -p tsconfig.check.json --noEmit" }, "exports": {}, "squirrel": { diff --git a/src/decorators.ts b/src/decorators.ts index a66cf60..eb54fad 100644 --- a/src/decorators.ts +++ b/src/decorators.ts @@ -103,9 +103,9 @@ export function createIdentifier(id: string): IdentifierDecorator { knownIdentifiers.add(id) } - const decorator = function (registerTarget: Ctor, _key: string, index: number): void { + const decorator = (function (registerTarget: Ctor, _key: string, index: number): void { setDependency(registerTarget, decorator, index) - } as IdentifierDecorator // decorator as an identifier + }) as IdentifierDecorator // decorator as an identifier decorator.toString = () => id decorator[IdentifierDecoratorSymbol] = true diff --git a/src/dependencyIdentifier.ts b/src/dependencyIdentifier.ts index 711e860..2734e8f 100644 --- a/src/dependencyIdentifier.ts +++ b/src/dependencyIdentifier.ts @@ -6,15 +6,15 @@ export const IdentifierDecoratorSymbol = Symbol('$$IDENTIFIER_DECORATOR') export type IdentifierDecorator = { [IdentifierDecoratorSymbol]: true - /** - * decorator - */ - (target: Ctor, key: string, index: number): void + // call signature of an decorator + (...args: any[]): void /** * beautify console */ toString(): string + + type: T } export type DependencyIdentifier = string | Ctor | ForwardRef | IdentifierDecorator diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dcc1cec07b53d6acd0872c7c122f8e323a1d69a8 GIT binary patch literal 6148 zcmeHKOHRWu5S=MOL}Jq=OCN#Wz*IqE-wjJ>D;1=CDnS>BO}2<@aUxE@n;8?55{Vr` zbVjnDJs(fb>G&{ zef`?y?qaLvEAyCrm{-2Hi!!l4hzFD7gaEu2_0W1W=w^YX&!WXnO_ ziKC(S&VVy8WZ=lAQ>p)#_?1R4`NI&OIRnnXKVyKiVo}WTQmM9ndp)VO0qq7&MEqJA pKrq%)4AfGLiR>e1YBYP0G3+s6YbdLTUc-TY5KuzAa|V8afe&$6M