rollup-plugin-ts not compatible with TypeScript 4.7-4.9
matthew-dean opened this issue · comments
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.
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
Hi there.
Hey there. TypeScript v4.9 support, as well as support for the latest Rollup version has been added in v3.10.0