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

rollup-plugin-ts not compatible with TypeScript 4.7-4.9 #196

Closed
matthew-dean opened this issue Nov 22, 2022 · 2 comments
Closed

rollup-plugin-ts not compatible with TypeScript 4.7-4.9 #196

matthew-dean opened this issue Nov 22, 2022 · 2 comments

Comments

@matthew-dean
Copy link

matthew-dean commented Nov 22, 2022

Sorry, don't have time to leave a proper bug report, but just wanted to flag this sooner rather than later.

After upgrading to TypeScript 4.9.3, this plugin fails with an error message like:

TypeError: path.charCodeAt is not a function
    at getEncodedRootLength (.../node_modules/.pnpm/typescript@4.9.3/node_modules/typescript/lib/typescript.js:7683:24)

If you log the path, it (or Rollup? it's not clear) is returning { pos: 22, end: 27, fileName: 'react' } when resolving React for a .d.ts file like:

/// <reference types="react" />
declare const createReducerContext: <R extends import("react").Reducer<any, any>>(reducer: R, defaultInitialState: import("react").ReducerState<R>) => readonly [() => [import("react").ReducerState<R>, import("react").Dispatch<import("react").ReducerAction<R>>], ({ children, initialState, }: {
    children?: React.ReactNode;
    initialState?: import("react").ReducerState<R> | undefined;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<[import("react").ReducerState<R>, import("react").Dispatch<import("react").ReducerAction<R>>] | undefined>>, import("react").Context<[import("react").ReducerState<R>, import("react").Dispatch<import("react").ReducerAction<R>>] | undefined>];
export default createReducerContext;

The resolved moduleName is not a string, so TypeScript crashes.

I installed versions of TypeScript 4.6.4-4.9.3 and from 4.7 on, this fails.

@matthew-dean matthew-dean changed the title rollup-plugin-ts not compatible with TypeScript 4.9.3 rollup-plugin-ts not compatible with TypeScript 4.7-4.9 Nov 22, 2022
@elchininet
Copy link

elchininet commented Dec 21, 2022

Hi @matthew-dean,
Which version of rollop-plugin-ts are you using? I had that issue some time ago and it was fixed in version 3.0.0: #181

@wessberg
Copy link
Owner

wessberg commented Jan 9, 2023

Hi there.

Hey there. TypeScript v4.9 support, as well as support for the latest Rollup version has been added in v3.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants