Skip to content

Commit dcfb7f2

Browse files
authored
LogService - fix typings (#1034)
* LogService - fix typings * LogService - add a deprecation log without the newProp
1 parent b5d2fb5 commit dcfb7f2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

generatedTypes/services/LogService.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
declare function warn(message: string): void;
2-
declare function deprecationWarn({ component, oldProp, newProp }?: ({
3-
component?: string;
4-
oldProp?: string;
2+
declare function deprecationWarn({ component, oldProp, newProp }: {
3+
component: string;
4+
oldProp: string;
55
newProp?: string;
6-
})): void;
6+
}): void;
77
declare const _default: {
88
warn: typeof warn;
99
deprecationWarn: typeof deprecationWarn;

src/services/LogService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ function warn(message: string) {
44
}
55
}
66

7-
function deprecationWarn({component, oldProp, newProp}: ({component?: string, oldProp?: string, newProp?: string}) = {}) {
8-
const message = `uilib's ${component} "${oldProp}" prop will be deprecated soon, please use the "${newProp}" prop instead`;
7+
function deprecationWarn({component, oldProp, newProp}: {component: string; oldProp: string; newProp?: string}) {
8+
const message = newProp
9+
? `uilib's ${component} "${oldProp}" prop will be deprecated soon, please use the "${newProp}" prop instead`
10+
: `uilib's ${component} "${oldProp}" prop will be deprecated soon, please stop using it`
11+
;
912
warn(message);
1013
}
1114

0 commit comments

Comments
 (0)