Skip to content

Commit

Permalink
restore formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dpnolte committed May 5, 2020
1 parent da799c1 commit de9e7a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/withESI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface IWithESIProps {
esi?: {
attrs?: {
[key: string]: string | null;
} | null;
} | null;
};
};
}

/**
Expand All @@ -26,20 +26,20 @@ interface IWithESIProps {
export default function withESI<P>(
WrappedComponent: React.ComponentType<P>,
fragmentID: string
): React.ComponentClass<P & IWithESIProps> {
return class WithESI extends React.Component<P & IWithESIProps> {
): React.ComponentClass<IWithESIProps & P> {
return class WithESI extends React.Component<P> {
public static WrappedComponent = WrappedComponent;
public static displayName = `WithESI(${WrappedComponent.displayName ||
WrappedComponent.name ||
"Component"})`;
public static propTypes = ({
public static propTypes = {
esi: PropTypes.shape({
attrs: PropTypes.objectOf(PropTypes.string), // extra attributes to add to the <esi:include> tag
}),
} as unknown) as WeakValidationMap<P & IWithESIProps>;
attrs: PropTypes.objectOf(PropTypes.string) // extra attributes to add to the <esi:include> tag
})
} as unknown as WeakValidationMap<IWithESIProps & P>;
public state = {
childProps: {},
initialChildPropsLoaded: true,
initialChildPropsLoaded: true
};
private esi = {};

Expand All @@ -57,7 +57,7 @@ export default function withESI<P>(
// Inject server-side computed initial props
this.state.childProps = {
...window.__REACT_ESI__[fragmentID],
...this.state.childProps,
...this.state.childProps
};
return;
}
Expand All @@ -78,7 +78,7 @@ export default function withESI<P>(
.then((initialProps: object) =>
this.setState({
childProps: initialProps,
initialChildPropsLoaded: true,
initialChildPropsLoaded: true
})
);
}
Expand All @@ -87,7 +87,7 @@ export default function withESI<P>(
if ((process as IWebpackProcess).browser) {
return (
<div>
<WrappedComponent {...(this.state.childProps as P)} />
<WrappedComponent {...this.state.childProps as P} />
</div>
);
}
Expand All @@ -102,7 +102,7 @@ export default function withESI<P>(
fragmentID,
this.props,
this.esi
),
)
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./lib/",
Expand Down

0 comments on commit de9e7a4

Please sign in to comment.