diff --git a/projects/cdk/types/index.ts b/projects/cdk/types/index.ts index 6cc2e332089b..14e273a7b0a9 100644 --- a/projects/cdk/types/index.ts +++ b/projects/cdk/types/index.ts @@ -2,6 +2,7 @@ export * from './date-mode'; export * from './dialog'; export * from './event-with'; export * from './handler'; +export * from './injection-token-type'; export * from './input-mode'; export * from './input-type'; export * from './mapper'; diff --git a/projects/cdk/types/injection-token-type.ts b/projects/cdk/types/injection-token-type.ts new file mode 100644 index 000000000000..98ab4ba810bf --- /dev/null +++ b/projects/cdk/types/injection-token-type.ts @@ -0,0 +1,5 @@ +import type {InjectionToken} from '@angular/core'; + +export type TuiInjectionTokenType = Token extends InjectionToken + ? T + : never; diff --git a/projects/core/components/scrollbar/scrollbar.component.ts b/projects/core/components/scrollbar/scrollbar.component.ts index c3fc35b0e451..16941a98e12d 100644 --- a/projects/core/components/scrollbar/scrollbar.component.ts +++ b/projects/core/components/scrollbar/scrollbar.component.ts @@ -7,8 +7,14 @@ import { Inject, Input, } from '@angular/core'; -import {CSS, USER_AGENT} from '@ng-web-apis/common'; -import {getElementOffset, isFirefox, TUI_IS_IOS, tuiDefaultProp} from '@taiga-ui/cdk'; +import {CSS as CSS_TOKEN, USER_AGENT} from '@ng-web-apis/common'; +import { + getElementOffset, + isFirefox, + TUI_IS_IOS, + tuiDefaultProp, + TuiInjectionTokenType, +} from '@taiga-ui/cdk'; import {TUI_SCROLL_INTO_VIEW, TUI_SCROLLABLE} from '@taiga-ui/core/constants'; import {TUI_SCROLL_REF} from '@taiga-ui/core/tokens'; @@ -47,7 +53,8 @@ export class TuiScrollbarComponent { readonly browserScrollRef = new ElementRef(this.elementRef.nativeElement); constructor( - @Inject(CSS) private readonly cssRef: any, + @Inject(CSS_TOKEN) + private readonly cssRef: TuiInjectionTokenType, @Inject(ElementRef) private readonly elementRef: ElementRef, @Inject(USER_AGENT) private readonly userAgent: string, @Inject(TUI_IS_IOS) private readonly isIos: boolean,