Skip to content

Commit

Permalink
fix(core): prevent injection conflict with CSS global interface
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Aug 29, 2022
1 parent 6bac921 commit 9e79144
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions projects/cdk/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 5 additions & 0 deletions projects/cdk/types/injection-token-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {InjectionToken} from '@angular/core';

export type TuiInjectionTokenType<Token> = Token extends InjectionToken<infer T>
? T
: never;
13 changes: 10 additions & 3 deletions projects/core/components/scrollbar/scrollbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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<typeof CSS_TOKEN>,
@Inject(ElementRef) private readonly elementRef: ElementRef<HTMLElement>,
@Inject(USER_AGENT) private readonly userAgent: string,
@Inject(TUI_IS_IOS) private readonly isIos: boolean,
Expand Down

0 comments on commit 9e79144

Please sign in to comment.