-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Bug] number[] not assignable to ConcatArray<number> #32
Comments
Actually, let me investigate this further. |
I was experiencing other suspicious problems with this library and re-installed. It fixed those suspicious problems but this one remained. |
Thanks for this issue! First of all, I'm sorry that you are experiencing problems with ts-simple-type, I'll try to fix them as quickly as possible. I suspect the problems that you experienced before can be because of two different version of Typescript in your node_modules, because it will result in strange behavior due to incompatible TypeFlags. If you encounter strange problems again, I export an undocumented function called Regarding your problems with Requirement 1: First of all, an array can be represent with different types: Requirement 2: Secondly, the aim of this library is to provide an easy way to work with Typescript types. Therefore you should be able easily construct highly used types like const myArray = {
kind: 'GENERIC_ARGUMENTS',
typeArguments: [ { kind: 'NUMBER' } ] ,
target: {
kind: 'OBJECT',
name: 'Array',
typeParameters: [ { kind: 'GENERIC_PARAMETER', name: 'T' } ],
members: [
{ name: 'length', optional: false, type: { kind: 'NUMBER' } },
{ name: 'slice',
optional: false,
type:
{ kind: 'FUNCTION',
returnType:
{ kind: 'ARRAY',
type: { kind: 'GENERIC_PARAMETER', name: 'T' },
name: 'Array' },
argTypes:
[ { name: 'start',
optional: true,
type: { kind: 'NUMBER' },
spread: false,
initializer: false },
{ name: 'end',
optional: true,
type: { kind: 'NUMBER' },
spread: false,
initializer: false } ] } } ],
.........
.........
.........
]
}
} However less used types like Requirement 3: Thirdly, when comparing Typescript types, I first transform them to The Problem: For requirement 2, I parse highly used types like Solution: I have been thinking a lot on how to handle it. I don't want to build a half-baked, hard-coded solution, but I still want to include all 3 requirements. I also don't want to make a
This ended up a bit long and technical, but I hope you understand my thoughts and concerns. I'll keep you updated on the progress in this issue 👍 |
I actually appreciate that you went long and technical. I understand that type checking is a beast, even more so with structural type systems! |
According to TS,
number[]
is assignable toConcatArray<number>
.But
ts-simple-type
does not think so.The text was updated successfully, but these errors were encountered: