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 0000000..dcc1cec Binary files /dev/null and b/test/.DS_Store differ diff --git a/tsconfig.check.json b/tsconfig.check.json new file mode 100644 index 0000000..4dea500 --- /dev/null +++ b/tsconfig.check.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*", "test/**/*"] +}