gristlabs/ts-interface-checker

It looks like an interface with properties of that interface (recursive) is not supported

zoechi opened this issue · 3 comments

The library looks great so far. Thanks for publishing!
I run into a problem though:

export interface FormConfig {
  children?: FormConfig[];
 ● Test suite failed to run

    RangeError: Maximum call stack size exceeded

      at getNamedType (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:33:22)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:56:21)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)
      at TName.Object.<anonymous>.TName.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:57:29)
      at TArray.Object.<anonymous>.TArray.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:101:38)
      at ../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:79
          at Array.map (<anonymous>)
      at TIface.Object.<anonymous>.TIface.getChecker (../../node_modules/.pnpm/ts-interface-checker@0.1.13/node_modules/ts-interface-checker/dist/types.js:329:39)

Is this a known issue?
Is there a workaround?

Interesting! I don't think it was a known issue, probably only because no one had used ts-interface-checker with a recursive interface. But now that you bring it up, it should've been expected.

I don't know of an easy workaround, I think we'll need to fix it in code.

That would be great. We could make these properties object and then cast when accessed, but these properties are not too surprisingly exactly these where the checks are most important.

Thanks a lot! The last update solves the biggest hurdles. Super useful package \o/