GithubHelp home page GithubHelp logo

Comments (5)

timocov avatar timocov commented on May 18, 2024

Hi @Scorpio1337,

actually this is second known limitation (see https://github.com/timocov/dts-bundle-generator/blob/master/README.md#known-limitations). I believe this issue can be solved along with other issues marked with https://github.com/timocov/dts-bundle-generator/issues?q=is%3Aissue+is%3Aopen+label%3Adetect-import-path-problem label.

As workaround you can try to import without renaming, e.g. import { Stats } from 'fs', but it can doesn't work in some cases.

from dts-bundle-generator.

musicode avatar musicode commented on May 18, 2024

@timocov

I have a similar issue.

For example, there are some helper functions in a.ts, I hope to export a as a property from b.

but dts-bundle-generator can't do that.

a.ts

export function doSomething1() {
}

export function doSomething2() {
}

b.ts

import * as a from './a'

export default {
  a: a
}

from dts-bundle-generator.

timocov avatar timocov commented on May 18, 2024

@musicode what error you get? It looks your issue is about 2nd known limitation (see https://github.com/timocov/dts-bundle-generator#known-limitations).

from dts-bundle-generator.

musicode avatar musicode commented on May 18, 2024

yes, It's 2nd known limitation, but I think it's maybe useful.

for my scenario, I have a module a that define some helper functions.

then I want to export a from entry point.

b.ts

import * as a from './a'

export default {
  a: a
}

then I can use it like below:

import b from 'b'
b.a.doSomething1()

It's a common case, I need type suggestion in my vscode.but dts-bundle-generator will report a is not define.

so i have to write a declaration file manually, and set the type for a.

import * as a from './a'
import aType from './aType'

export default {
  a: aType: a
}

It's ok, but it's so trouble and hard to maintenance.

from dts-bundle-generator.

antoninbouchal avatar antoninbouchal commented on May 18, 2024

Thank you guys ... As I sad, I use right now "hack" with require.
It is not good because I must use is really often. :D

from dts-bundle-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.