Skip to content
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

Fix class functions and improve typing #324

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions src/__tests__/commands/__snapshots__/build.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13282,7 +13282,7 @@ export const AnalyticsProvider = ({
return <Context.Provider value={client}>{children}</Context.Provider>;
};

export const useAnalytics = () => {
export const useAnalytics = (): TypewriterSegmentClient | {} => {
const client = useContext(Context);
if (!client) {
console.error(
Expand All @@ -13293,9 +13293,8 @@ export const useAnalytics = () => {
// @ts-ignore
return {};
}
return {
...client,
};

return client;
};

"
Expand Down
7 changes: 3 additions & 4 deletions src/languages/templates/typescript/react-native.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const AnalyticsProvider = ({
return <Context.Provider value={client}>{children}</Context.Provider>;
};

export const useAnalytics = () => {
export const useAnalytics = (): TypewriterSegmentClient | {} => {
const client = useContext(Context);
if (!client) {
console.error(
Expand All @@ -54,7 +54,6 @@ export const useAnalytics = () => {
// @ts-ignore
return {};
}
return {
...client,
};

return client;
};