Hookyns / tst-reflect

Advanced TypeScript runtime reflection system
MIT License
338 stars 11 forks source link

"Error: Unknown type kind" when class has an array property #3

Closed Aurif closed 2 years ago

Aurif commented 3 years ago

Reproducible example:

import {getType, Type} from "tst-reflect";

class test {
    public list: string[];
}
console.log(getType<test>())

Generated error:

Error: Unknown type kind
    at Object.getTypeKind (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/helpers.js:34:11)
    at getTypeProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:46:28)
    at Object.getTypeCall [as default] (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:66:27)
    at members.filter.map (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getProperties.js:14:37)
    at Array.map (<anonymous>)
    at Object.getProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getProperties.js:12:14)
    at getTypeProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:50:32)
    at Object.getTypeCall [as default] (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:66:27)
    at visit (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/visitation.js:29:67)
    at visitor (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/visitation.js:41:30)
Error: Unknown type kind
    at Object.getTypeKind (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/helpers.js:34:11)
    at getTypeProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:46:28)
    at Object.getTypeCall [as default] (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:66:27)
    at members.filter.map (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getProperties.js:14:37)
    at Array.map (<anonymous>)
    at Object.getProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getProperties.js:12:14)
    at getTypeProperties (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:50:32)
    at Object.getTypeCall [as default] (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/getTypeCall.js:66:27)
    at visit (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/visitation.js:29:67)
    at visitor (/home/runner/tst-reflect-example-01/src/node_modules/tst-reflect-transformer/src/visitation.js:41:30)
Unknown type kind

If you replace string[] with string the error is gone and everything works fine, so it has something to do with arrays in the class.

Hookyns commented 3 years ago

@Filmos TY for reported issue.

I have big refactoring in progress and this is fixed in the refactored version. It'll be out in two weeks, I hope.

Hookyns commented 3 years ago

Two months have passed - instead of two weeks - and I still do the refactoring (it's partial rewrite more than refactoring). I'm getting close...

Hookyns commented 2 years ago

@Filmos try new versions of the packages. :)