Skip to content

Commit

Permalink
🐛 Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Jul 7, 2023
1 parent 493a79f commit c515afd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export function createIdentifier<T>(id: string): IdentifierDecorator<T> {
knownIdentifiers.add(id)
}

const decorator = function (registerTarget: Ctor<T>, _key: string, index: number): void {
const decorator = (<any>function (registerTarget: Ctor<T>, _key: string, index: number): void {
setDependency(registerTarget, decorator, index)
} as IdentifierDecorator<T> // decorator as an identifier
}) as IdentifierDecorator<T> // decorator as an identifier

decorator.toString = () => id
decorator[IdentifierDecoratorSymbol] = true
Expand Down
8 changes: 4 additions & 4 deletions src/dependencyIdentifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const IdentifierDecoratorSymbol = Symbol('$$IDENTIFIER_DECORATOR')
export type IdentifierDecorator<T> = {
[IdentifierDecoratorSymbol]: true

/**
* decorator
*/
(target: Ctor<T>, key: string, index: number): void
// call signature of an decorator
(...args: any[]): void

/**
* beautify console
*/
toString(): string

type: T
}

export type DependencyIdentifier<T> = string | Ctor<T> | ForwardRef<T> | IdentifierDecorator<T>
Expand Down
Binary file added test/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions tsconfig.check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*", "test/**/*"]
}

0 comments on commit c515afd

Please sign in to comment.