Skip to content

Commit

Permalink
fix: add ts definition for context
Browse files Browse the repository at this point in the history
  • Loading branch information
joshhowenstine committed Mar 12, 2024
1 parent 9b55dea commit c8ff258
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/@lightningjs/ui-components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
export * from './src/components';
export * from './src/mixins';
export * from './src/types/lui';
// export * from './src/globals';
export * from './src/globals';

// exports without type definitions
export { default as utils } from './src/utils';
Expand Down
33 changes: 33 additions & 0 deletions packages/@lightningjs/ui-components/src/globals/context/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
type ThemeObject = any;

Check warning on line 1 in packages/@lightningjs/ui-components/src/globals/context/index.d.ts

View workflow job for this annotation

GitHub Actions / quality / lint-unit

Unexpected any. Specify a different type

export class Context {
get theme(): ThemeObject;
set theme(value: ThemeObject);
get keyMetricsCallback(): object;
set keyMetricsCallback(value: object);
get debug(): boolean;
set debug(value: boolean);

on(name: string, callback: Function): void;
off(name: string, callback?: Function): void;
emit(name: string, payload: string | object | number | boolean): void;

log(...args: any[]): void;
info(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;

setTheme(value: object | any[]): ThemeObject;
updateTheme(value: object | any[]): ThemeObject;
getSubTheme(subThemeName: string): ThemeObject;
setSubThemes(subThemesObj: Record<string, any>): void;
setSubTheme(subThemeName: string, value: any): ThemeObject;
updateSubTheme(subThemeName: string, value: any): ThemeObject;
removeSubTheme(subThemeName: string): void;
setLogCallback(value: Function): void;
setKeyMetricsCallback(value: Function): void;
config(config: Record<string, any>): Context;
}

declare const contextInstance: Context;
export default contextInstance;
21 changes: 0 additions & 21 deletions packages/@lightningjs/ui-components/src/globals/index-remove.js

This file was deleted.

0 comments on commit c8ff258

Please sign in to comment.