You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I execute: dukat ./node_modules/react-helmet/index.d.ts
I get following error:
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.util.LinkedHashMap.getOrDefault(LinkedHashMap.java:453)
at org.jetbrains.dukat.tsLowerings.TypeSpecifierLowering.spec(TypeAliasContext.kt:20)
at org.jetbrains.dukat.tsLowerings.TypeSpecifierLowering.lowerParameterValue(TypeAliasContext.kt:39)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerUnionTypeDeclaration(DeclarationLowering.kt:132)
at org.jetbrains.dukat.tsLowerings.TypeSpecifierLowering.lowerUnionTypeDeclaration(TypeAliasContext.kt:15)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:239)
at org.jetbrains.dukat.tsLowerings.TypeSpecifierLowering.lowerParameterValue(TypeAliasContext.kt:39)
at org.jetbrains.dukat.tsLowerings.TypeAliasContext.dereference(TypeAliasContext.kt:65)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.resolveType(resolveTypeAliases.kt:46)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.unroll(resolveTypeAliases.kt:56)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.unroll(resolveTypeAliases.kt:56)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerUnionTypeDeclaration(resolveTypeAliases.kt:65)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:239)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerTypeDeclaration(DeclarationLowering.kt:144)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerTypeDeclaration(resolveTypeAliases.kt:44)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:237)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerUnionTypeDeclaration(DeclarationLowering.kt:132)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerUnionTypeDeclaration(resolveTypeAliases.kt:65)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:239)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerTypeDeclaration(DeclarationLowering.kt:144)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerTypeDeclaration(resolveTypeAliases.kt:44)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:237)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerUnionTypeDeclaration(DeclarationLowering.kt:132)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerUnionTypeDeclaration(resolveTypeAliases.kt:65)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:239)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerTypeDeclaration(DeclarationLowering.kt:144)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerTypeDeclaration(resolveTypeAliases.kt:44)
at org.jetbrains.dukat.tsLowerings.DeclarationLowering$DefaultImpls.lowerParameterValue(DeclarationLowering.kt:237)
at org.jetbrains.dukat.tsLowerings.ResolveTypeAliasesLowering.lowerParameterValue(resolveTypeAliases.kt:50)
🙂 Expected behavior
That the command does what it's supposed to do.
Investigation
I've investigated it further. The problem seems to be related to this type: JSX.IntrinsicElements
This is part of the typescript library. Maybe there are more problems with the indirekt use of the typescript library?
It seams there is a second problem:
All the React. usages cause the same stackoverflow error.
If you remove all dependencies on JSX.IntrinsicElements and React everything works fine.
If someone knows how to make a own wrapper for this, please tell me. We need this for our project.
Update 1
Quick fix for small packages: Copy the index.d.ts to a new destination remove the import import * as React from "react"; . Run dukat and it should generate some code. Put the generated code into you project eg. wrappers. Now you have a direction for your own wrapper. There are multiple things to change before use but more than nothing.
The text was updated successfully, but these errors were encountered:
You may be able to minimize hand tweaking of generated definitions by hacking the source package .d.ts file(s), replacing the wildcard import with the specific references used in that file, then also changing the corresponding references to match.
I was trying to generate wrappers for @mui/x-data-grid, and found this in node_modules/@mui/x-data-grid/index.d.ts:
import*asReact from 'react';
import{GridApiCommunity } from './models/api/gridApiCommunity';
. . .
export declare type GridApiRef=React.MutableRefObject<GridApiCommunity>;
Where the only reference to React in this file was React.MutableRefObject, fortunately for me. I changed that to:
import{MutableRefObject} from 'react';
import{GridApiCommunity } from './models/api/gridApiCommunity';
. . .
export declare type GridApiRef=MutableRefObject<GridApiCommunity>;
and dukat seems to have processed the whole module successfully.
Project folk: I have no idea of the complexity of a fix for this bug, but it seems multiple people have tripped over it in various guises, and React-based packages are fairly widely deployed, so it might be worth some early attention.
🕗 Version
dukat version 0.5.8-rc.4
💻 Code or Package Name
react-helmet
🙁 Actual behavior
When I execute:
dukat ./node_modules/react-helmet/index.d.ts
I get following error:
🙂 Expected behavior
That the command does what it's supposed to do.
Investigation
I've investigated it further. The problem seems to be related to this type:
JSX.IntrinsicElements
This is part of the typescript library. Maybe there are more problems with the indirekt use of the typescript library?
It seams there is a second problem:
All the
React.
usages cause the same stackoverflow error.If you remove all dependencies on
JSX.IntrinsicElements
andReact
everything works fine.If someone knows how to make a own wrapper for this, please tell me. We need this for our project.
Update 1
Quick fix for small packages: Copy the index.d.ts to a new destination remove the import
import * as React from "react";
. Run dukat and it should generate some code. Put the generated code into you project eg.wrappers
. Now you have a direction for your own wrapper. There are multiple things to change before use but more than nothing.The text was updated successfully, but these errors were encountered: