-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
How to add local module declaration to generated types? #102
Comments
Hi there, these errors are caused because you don't provide the compiler information about which types you need to load in specific files to being compiled. I meant, that for the compiler it's enough to So, to fix it try to add |
@timocov thanks for super quick response! I only needed to add Since the project already contained a Thank you so much! 😄 |
You're welcome! 🙂 |
@timocov I've a follow up question: because of your help my previous issue was resolved. However, I noticed that inside my generated How do I actually add my custom |
How that types are "injected" to the generated dts file? Via
See at |
They are imported like this:
This however only imports the 'default' types from the I've the following in my "importedLibraries": [
"moment",
"react-dates",
"react-table"
] |
I'm not sure that this could be solved somehow. You can try to set I don't know what a good solution for you is for this, possible make a PR in https://github.com/DefinitelyTyped/DefinitelyTyped with fixes? Maybe use declaration merging is better than write your own "package" with types for that library (declaration merge allows you "override" or "add" some types to libraries outside of your project - see https://www.typescriptlang.org/docs/handbook/declaration-merging.html). I'd say that I need to better understand your case... |
Hi @timocov , I'll try to explain my situation better: the This is because the This isn't being done automatically though: you need to do this yourself. This is why I added a export interface TableOptions<D extends object>
extends UseExpandedOptions<D>,
UseFiltersOptions<D>,
UseGroupByOptions<D>,
UsePaginationOptions<D>,
UseRowSelectOptions<D>,
UseSortByOptions<D> {} The export interface TableOptions<D extends object> extends UseTableOptions<D> {} Since my own Let me know if you need any more information, will be happy to provide it! |
@daviddelusenet sorry for the delay. Do you have any example of the project uses react-table library and provides typings? At the moment I think that you don't need to "extend" the |
Hi @timocov , sorry for the delay. Here you can read about the So I've done exactly what it says there and that works great during development. However, these types don't get included in the build. |
@timocov here you can read more about what I've done: TanStack/table#1591 So basically I've done this:
|
Fixed it by just turning on the |
@daviddelusenet Sorry for the delay - last days I was on a vacation so I can't even check out/play with that. If it works for you - awesome 🎉 🙂 |
Hi,
I'm using this tool in my project which is also using the react-table package. The types of this package are published separately to the DefinitelyTyped repo.
However, the types of the
react-table
aren't ready to use: you need to create your ownreact-table.d.ts
file inside of your project where you specify all of the hooks you're using. Now my problem is that I can't get thedts-bundle-generator
to add thereact-table.d.ts
file to my output causing the build to fail. This is what I'm seeing:If I remove the
react-table.d.ts
file and runtsc
to do a types check these are the exact errors I'm getting.This are the contents of my
tsconfig.json
:Contents of
dtsconfig.json
:If you need any more information please let me know. Our team has been stuck for over a week now trying to figure out this issue and it's completely blocking our workflow since we can't publish new versions of our package anymore.
Thanks in advance!
The text was updated successfully, but these errors were encountered: