dts-bundle-generator icon indicating copy to clipboard operation
dts-bundle-generator copied to clipboard

Imported namespace "types" from babel missing in generated d.ts output

Open IgnusG opened this issue 3 years ago • 3 comments

Bug report

Input code

import { types } from "@babel/core"

export type AnyJSXElement = types.CallExpression | types.JSXElement;

export function isAnyJSXElementPath(path: NodePath): path is NodePath<AnyJSXElement> {
	return true;
}

Expected output

import { NodePath, types } from '@babel/core';

export declare type AnyJSXElement = types.CallExpression | types.JSXElement;
export declare function isAnyJSXElementPath(path: NodePath): path is NodePath<AnyJSXElement>;

Actual output

import { NodePath } from '@babel/core';

export declare type AnyJSXElement = types.CallExpression | types.JSXElement;
export declare function isAnyJSXElementPath(path: NodePath): path is NodePath<AnyJSXElement>;

Additional context Version : 6.12.0

IgnusG avatar Jul 18 '22 21:07 IgnusG

@IgnusG can you provide a full repro please? It seems that @babel/core doesn't include types and there is no package @types/@babel nor @types/babel nor @types/@babel/core nor @types/@babel/core so I stopped guessing at this point. Thanks!

timocov avatar Jul 24 '22 12:07 timocov

Scoped packages in the @types repo are in the form of @types/scope__name (otherwise they would be invalid as package names) so @babel/core is available under @types/babel__core 😉

I can make a simple repro though if you'd like 👍

IgnusG avatar Jul 24 '22 12:07 IgnusG

I can make a simple repro though if you'd like 👍

@IgnusG Yes please! I think creating a simple repro steps is a good approach to report bugs (you don't even need to ask whether I would like to see it or not) - it helps maintainers not to waste time of guessing what is going on and you to get the help faster.

timocov avatar Aug 13 '22 11:08 timocov

@timocov I encountered this issue too.

Here is a simple minimum repo (with just two ts files) to demonstrate this issue. https://github.com/3cp/namespace-bug

Please read the readme for more information.

3cp avatar Oct 02 '22 07:10 3cp

@3cp your issue related to https://github.com/timocov/dts-bundle-generator/issues/134

timocov avatar Oct 02 '22 16:10 timocov

@IgnusG do you have any updates on this?

timocov avatar Nov 21 '22 20:11 timocov

I'm going to close the issue. If you'll have any question or updates - feel free to ping me.

timocov avatar Mar 30 '23 12:03 timocov