-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
In certain cases TS 2.9 outputs incorrect definitions (.d.ts) #25511
Comments
Having the same issue with a monorepo like structure too using oao and with Typescript 2.9.2 |
Formik has this issue and I'm not sure how to proceed.
|
Update: I bumped to v3.0.0-dev and this has been fixed. New output looks like: import * as React from 'react';
import { FormikContext } from './types';
export declare const FormikProvider: React.ComponentClass<import("create-react-context").ProviderProps<FormikContext<any>>>, FormikConsumer: React.ComponentClass<import("create-react-context").ConsumerProps<FormikContext<any>>>;
export declare function connect<OuterProps, Values = {}>(Comp: React.ComponentType<OuterProps & {
formik: FormikContext<Values>;
}>): React.ComponentClass<OuterProps> & {
WrappedComponent: React.ComponentClass<OuterProps & {
formik: FormikContext<Values>;
}>;
}; |
@jaredpalmer Yeah, as i mentioned before TS@3.0 solves some of the issue, but it doesn't solve it completely for us :( I should actually try new monorepo support in 3.0 (a.k.a references) and see how it goes... |
I just tried references, and it didn't help... |
More specifically, installing today's release worked:
|
@jaredpalmer I was experiencing similar issues with StyledComponents and today's release did fix my problems. Thank you! |
This is happening to me in a non-monorepo setup with typescript 2.9.2. This function: export const robotError = (code: number, trace?: Error) => errors.error(code, trace); Is converted to this declaration: export declare const robotError: (code: number, trace?: Error | undefined) => import("../../../../../../../Users/drew/projects/versabuilt/drivers/robot/node_modules/@vb/error/dist/definitions").VBError; I think it must be implicit return type causing the issue. |
The issue most people here are harping on should have been fixed by #25364 and #25364. There's some comments in this threads stating that recent releases have worked for people in this thread - anyone here still having issues should try the latest 3.0 nightly and open a new issue (ideally with detailed repro steps, including full filesystem paths of the involved files) if it still reproduces under some set of circumstances for you. |
TypeScript Version: 2.9.2 and 3.0.0-dev.201xxxxx
Search Terms: relaxed, declarations
Expected behavior:
Definitions have correct import statements.
Actual behavior:
In certain cases e.g. monorepo structure where dependencies are linked inside packages from the root
node_modules
folder (you can read about that more here: bolt) output .d.ts files contain pretty weird paths...Code: https://github.com/d4rkr00t/tsc29-test-relaxed-resolve
Outputs definition file:
I've also tried that with TS 3.0 it's a little bit better, first file gets correct deffinitions:
But another module that imports the previous one still gets wrong definitions (even though, they look sort of reasonable, but probably the fact that package-a is inside node_modules should indicate that this is a module, i'm not sure if it's fair to assume that :) ):
In version below 2.9 we had to import those things manually and it used to work, but now we can't do it manually anymore as it has no difference...
The text was updated successfully, but these errors were encountered: