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 TS types #1582

Merged
merged 2 commits into from
Nov 15, 2023
Merged
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
8 changes: 4 additions & 4 deletions node_package/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { ReactElement, ReactNode, Component, FunctionComponent, ComponentClass } from 'react';
import type { ReactElement, ReactNode, Component, ComponentType } from 'react';

// Don't import redux just for the type definitions
// See https://github.com/shakacode/react_on_rails/issues/1321
/* eslint-disable @typescript-eslint/no-explicit-any */
type Store = any;

type ReactComponent = FunctionComponent | ComponentClass | string;
type ReactComponent = ComponentType<any> | string;

// Keep these in sync with method lib/react_on_rails/helper.rb#rails_context
export interface RailsContext {
Expand Down Expand Up @@ -33,7 +33,7 @@ type AuthenticityHeaders = {[id: string]: string} & {'X-CSRF-Token': string | nu
type StoreGenerator = (props: Record<string, unknown>, railsContext: RailsContext) => Store

interface ServerRenderResult {
renderedHtml?: string;
renderedHtml?: string | { componentHtml: string; [key: string]: string };
redirectLocation?: {pathname: string; search: string};
routeError?: Error;
error?: Error;
Expand All @@ -44,7 +44,7 @@ type CreateReactOutputResult = ServerRenderResult | ReactElement | Promise<strin
type RenderFunctionResult = ReactComponent | ServerRenderResult | Promise<string>;

interface RenderFunction {
(props?: Record<string, unknown>, railsContext?: RailsContext, domNodeId?: string): RenderFunctionResult;
(props?: any, railsContext?: RailsContext, domNodeId?: string): RenderFunctionResult;
// We allow specifying that the function is RenderFunction and not a React Function Component
// by setting this property
renderFunction?: boolean;
Expand Down
Loading