mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix(editor): improve type declaration definition (#10866)
Closes: [BS-2809](https://linear.app/affine-design/issue/BS-2809/改进继承自抽象类的类型后-createidentifier-类型定义) ### What's Changed! * Improved type declaration definition
This commit is contained in:
@@ -78,10 +78,11 @@ import type {
|
||||
export function createIdentifier<T>(
|
||||
name: string,
|
||||
variant: ServiceVariant = DEFAULT_SERVICE_VARIANT
|
||||
): ServiceIdentifier<T> & ((variant: ServiceVariant) => ServiceIdentifier<T>) {
|
||||
): ServiceIdentifier<T> &
|
||||
(<U extends T = T>(variant: ServiceVariant) => ServiceIdentifier<U>) {
|
||||
return Object.assign(
|
||||
(variant: ServiceVariant) => {
|
||||
return createIdentifier<T>(name, variant);
|
||||
<U extends T = T>(variant: ServiceVariant) => {
|
||||
return createIdentifier<U>(name, variant);
|
||||
},
|
||||
{
|
||||
identifierName: name,
|
||||
|
||||
Reference in New Issue
Block a user