Skip to content

Feat/log service migrate to typescript #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generatedTypes/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Please use this file for declaring all the exports, so they could be picked up by typescript's complier
*/
export * from './style';
export * from './services';
export * as Incubator from './incubator';
export {asBaseComponent, withScrollEnabler, withScrollReached, WithScrollEnablerProps, WithScrollReachedProps} from './commons/new';
export {default as Avatar, AvatarPropTypes} from './components/avatar';
Expand Down
11 changes: 11 additions & 0 deletions generatedTypes/services/LogService.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare function warn(message: string): void;
declare function deprecationWarn({ component, oldProp, newProp }?: ({
component?: string;
oldProp?: string;
newProp?: string;
})): void;
declare const _default: {
warn: typeof warn;
deprecationWarn: typeof deprecationWarn;
};
export default _default;
1 change: 1 addition & 0 deletions generatedTypes/services/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as LogService } from './LogService';
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

export * from './style';
export * from './services';
export * as Incubator from './incubator';
export {default as Avatar, AvatarPropTypes} from './components/avatar';
export {default as Card, CardPropTypes, CardSectionProps} from './components/card';
Expand Down
10 changes: 0 additions & 10 deletions src/services/LogService.js

This file was deleted.

15 changes: 15 additions & 0 deletions src/services/LogService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function warn(message: string) {
if (__DEV__) {
console.warn(message);
}
}

function deprecationWarn({component, oldProp, newProp}: ({component?: string, oldProp?: string, newProp?: string}) = {}) {
const message = `uilib's ${component} "${oldProp}" prop will be deprecated soon, please use the "${newProp}" prop instead`;
warn(message);
}

export default {
warn,
deprecationWarn
};
5 changes: 0 additions & 5 deletions src/services/index.js

This file was deleted.

1 change: 1 addition & 0 deletions src/services/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as LogService} from './LogService';