Skip to content

Commit c20748f

Browse files
authored
Feat/log service migrate to typescript (#924)
* Rename LogService from .js to .tsx * Rename services/index from .js to .tsx * Migrate LogService to typescript
1 parent cd4dd66 commit c20748f

File tree

8 files changed

+30
-15
lines changed

8 files changed

+30
-15
lines changed

generatedTypes/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Please use this file for declaring all the exports, so they could be picked up by typescript's complier
55
*/
66
export * from './style';
7+
export * from './services';
78
export * as Incubator from './incubator';
89
export {asBaseComponent, withScrollEnabler, withScrollReached, WithScrollEnablerProps, WithScrollReachedProps} from './commons/new';
910
export {default as Avatar, AvatarPropTypes} from './components/avatar';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare function warn(message: string): void;
2+
declare function deprecationWarn({ component, oldProp, newProp }?: ({
3+
component?: string;
4+
oldProp?: string;
5+
newProp?: string;
6+
})): void;
7+
declare const _default: {
8+
warn: typeof warn;
9+
deprecationWarn: typeof deprecationWarn;
10+
};
11+
export default _default;

generatedTypes/services/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as LogService } from './LogService';

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
export * from './style';
8+
export * from './services';
89
export * as Incubator from './incubator';
910
export {default as Avatar, AvatarPropTypes} from './components/avatar';
1011
export {default as Card, CardPropTypes, CardSectionProps} from './components/card';

src/services/LogService.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/services/LogService.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function warn(message: string) {
2+
if (__DEV__) {
3+
console.warn(message);
4+
}
5+
}
6+
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`;
9+
warn(message);
10+
}
11+
12+
export default {
13+
warn,
14+
deprecationWarn
15+
};

src/services/index.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/services/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {default as LogService} from './LogService';

0 commit comments

Comments
 (0)