Skip to content

v7 - types not being exported by react-router #12431

@kelvin2200

Description

@kelvin2200

I'm using React Router as a...

library

Reproduction

import { matchRoutes } from "react-router";

import { createBrowserHistory } from "history";


export const history = createBrowserHistory();

const routes = [];

/**
 * Bogus function
 * not used anywhere
 * needed to generate a type that we cannot import
 */
function makeInitialMatchesDummy(routes: any[]) {
	return matchRoutes(routes, history.location.pathname);
}

const initialMatches: NonNullable<ReturnType<typeof makeInitialMatchesDummy>> = [];

// exporting this type results in an error (does not happen with v6)
export type IniMatches = typeof initialMatches;

System Info

Windows 11, Vite, Yarn 4.5.3

Used Package Manager

yarn

Expected Behavior

I expect to be able to re-export any type that I can infer

Actual Behavior

react-router-7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions