We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there, I'm having troubles with deep-freeze library definition file and having a bit of trouble understanding how to fix it myself. Here is the definition file from typescript: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/deep-freeze/index.d.ts
Which gets converted to:
/** * Flowtype definitions for df.ts * Generated by Flowgen from a Typescript Definition * Flowgen v1.20.0 */ // see https://gist.github.com/thecotne/6e5969f4aaf8f253985ed36b30ac9fe0 type $FlowGen$If<X: boolean, Then, Else = empty> = $Call< ((true, Then, Else) => Then) & ((false, Then, Else) => Else), X, Then, Else >; type $FlowGen$Assignable<A, B> = $Call< ((...r: [B]) => true) & ((...r: [A]) => false), A >; declare module.exports: typeof deepFreeze; declare var deepFreeze: typeof npm$namespace$deepFreeze; declare var npm$namespace$deepFreeze: {| <T>(a: T[]): $ReadOnlyArray<deepFreeze$DeepReadonly<T>>, <T: Function>(f: T): T, <T>(o: T): deepFreeze$DeepReadonly<T>, |}; declare type deepFreeze$DeepReadonly<T> = $FlowGen$If< $FlowGen$Assignable<T, (...args: any) => any>, T, $ObjMapi<T, <P>(P) => deepFreeze$DeepReadonly<$ElementType<T, P>>> >;
This seems to work for objects but not for arrays: https://flow.org/try/#0PQKhCgAIUgxAbA9gdwC4E8AOBTSATbAMwEsA7Y1YxUgZ0kMQCd9CA6VGqGAcW1O0YBDVNjyQARujhJkAcz71GiALaRBkACpZsNAMaNimVJAAiRMhSqku0lPNKQAbgEZWAJgAMrD12DhwwMCQNNi4ABaoqJg0AFyBssQ0qKwJqGEAruKsuirAadg5qPzAAGzYAKwAnCWVhAAsgoKEAByEbuUAzJXN5aIdJeIdHoK6tdg+GDiQACQIKLyk0wCShAA8ABoxEoiI8NiCpAA0mmF8xwCi8CGQALyQ2MpG6AB8tzMAwoLw8KtQkAAU-1QjHS2GOGlOR0glxCAEpbq8IXx4QAyAH-QhfELgyEXK7YeE3V4wgmHP7rMmQE5nP4k8DPADc-kmuFmMgW0wAgjQaMRZKRBOI9qtOccAEKvO7TT7fX5UwGsRWMLYAbTFAF1Ca9gaDUejFaxlZAVZzNQj6FjSX9OfSmeACLp4IJGLhlIg8Ok9qxsAAPTBMDhbFmIQj4UKYWAu7AAL2wTIdTpdTmdYewEajsaD2hDkFImGU0wFyh0mBG2GmBDTkdCsbtCeduEcKbzBaLJbLFfD1Zj2C2AG8AD5-VYaZ7-QRbDQqzVbaYAJX2eAA8qR4OhOYwhOhVpX0zXy2Y0wvBHhqGuR89npTICOtrB0qRdJRqGPCJPYZPrxf-oh31td92sbTIemDHqeq7bqOZIDgAvvGBSJrgLKpnuPbAeGYFnpBkozHMyAciscq4eyfBcjyfICkK2Ajsc-wGs6sixGopDoFqzEvNeGjXtMS7iAAVgAsoImDEDRN4AApjuJbEARmB4YYuWGrNMlwPHwqBaDgYmSZetr+P4gSQDktDGOodyyfu-x9jBsIBEEgisHgiSCnsYh3DqcbgMZSRqG8Fk9v8Kp-H2ABETk0C5oghVsmL4jBZKanZagqh46pvKFDCINFkAheIzohXBXnUD54hvIIKXqkyWThZFbmQB5TKGQ5mDpDQYT-AA5JlHWwgyQA
It generates the error:
const a = deepFreeze([ ^ Cannot call `deepFreeze` because boolean literal `false` [1] is incompatible with boolean literal `true` [2] in the first argument. [invalid-call-util] References: 29: $FlowGen$Assignable<T, (...args: any) => any>, ^ [1] 9: ((true, Then, Else) => Then) & ((false, Then, Else) => Else), ^ [2]
Compared to the typescript output which works correctly: https://www.typescriptlang.org/play?#code/FAEwpgxgNghgTmABAMwK4DsIBcCWB7dRcMABwDEEwAvMAHgBUA+AChgC5F6BtAXQEoOAJTAwQBKAE8AgnDgwJtYuUo0AdABEwpYaPEKmjANyhIsBCgzZ8hJRS00GiMAA8sYdCADOiMpdwEWZA56AU5jcGh4JDRMfxstZXs6JmY8YNDbFTANBJ0xdEkGI2ATSPN0GABbME8SGAgkTKTEAG9gRA7ELAkSJE1tEXzCpkQAXnbOyfonV3cvRGZVJfgAc08OGHQJPjHGRE2JCcnjxAB+TiOTzo4WxARdAolELgAFRBxCAGswCTxkTh4HH6JDyegYrx4ewAvsYoSUShACJ4sPsxkQEnZqGBmFwJi0AEQgHCeGAAIygYBA+I4yBgUE8YChABpgPxgIj0MjEKS0TAuAAGHjGUmqIkk8mUtFYOCoMCGIA
Any help appreciated.
Thank you!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi there, I'm having troubles with deep-freeze library definition file and having a bit of trouble understanding how to fix it myself. Here is the definition file from typescript:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/deep-freeze/index.d.ts
Which gets converted to:
This seems to work for objects but not for arrays: https://flow.org/try/#0PQKhCgAIUgxAbA9gdwC4E8AOBTSATbAMwEsA7Y1YxUgZ0kMQCd9CA6VGqGAcW1O0YBDVNjyQARujhJkAcz71GiALaRBkACpZsNAMaNimVJAAiRMhSqku0lPNKQAbgEZWAJgAMrD12DhwwMCQNNi4ABaoqJg0AFyBssQ0qKwJqGEAruKsuirAadg5qPzAAGzYAKwAnCWVhAAsgoKEAByEbuUAzJXN5aIdJeIdHoK6tdg+GDiQACQIKLyk0wCShAA8ABoxEoiI8NiCpAA0mmF8xwCi8CGQALyQ2MpG6AB8tzMAwoLw8KtQkAAU-1QjHS2GOGlOR0glxCAEpbq8IXx4QAyAH-QhfELgyEXK7YeE3V4wgmHP7rMmQE5nP4k8DPADc-kmuFmMgW0wAgjQaMRZKRBOI9qtOccAEKvO7TT7fX5UwGsRWMLYAbTFAF1Ca9gaDUejFaxlZAVZzNQj6FjSX9OfSmeACLp4IJGLhlIg8Ok9qxsAAPTBMDhbFmIQj4UKYWAu7AAL2wTIdTpdTmdYewEajsaD2hDkFImGU0wFyh0mBG2GmBDTkdCsbtCeduEcKbzBaLJbLFfD1Zj2C2AG8AD5-VYaZ7-QRbDQqzVbaYAJX2eAA8qR4OhOYwhOhVpX0zXy2Y0wvBHhqGuR89npTICOtrB0qRdJRqGPCJPYZPrxf-oh31td92sbTIemDHqeq7bqOZIDgAvvGBSJrgLKpnuPbAeGYFnpBkozHMyAciscq4eyfBcjyfICkK2Ajsc-wGs6sixGopDoFqzEvNeGjXtMS7iAAVgAsoImDEDRN4AApjuJbEARmB4YYuWGrNMlwPHwqBaDgYmSZetr+P4gSQDktDGOodyyfu-x9jBsIBEEgisHgiSCnsYh3DqcbgMZSRqG8Fk9v8Kp-H2ABETk0C5oghVsmL4jBZKanZagqh46pvKFDCINFkAheIzohXBXnUD54hvIIKXqkyWThZFbmQB5TKGQ5mDpDQYT-AA5JlHWwgyQA
It generates the error:
Compared to the typescript output which works correctly: https://www.typescriptlang.org/play?#code/FAEwpgxgNghgTmABAMwK4DsIBcCWB7dRcMABwDEEwAvMAHgBUA+AChgC5F6BtAXQEoOAJTAwQBKAE8AgnDgwJtYuUo0AdABEwpYaPEKmjANyhIsBCgzZ8hJRS00GiMAA8sYdCADOiMpdwEWZA56AU5jcGh4JDRMfxstZXs6JmY8YNDbFTANBJ0xdEkGI2ATSPN0GABbME8SGAgkTKTEAG9gRA7ELAkSJE1tEXzCpkQAXnbOyfonV3cvRGZVJfgAc08OGHQJPjHGRE2JCcnjxAB+TiOTzo4WxARdAolELgAFRBxCAGswCTxkTh4HH6JDyegYrx4ewAvsYoSUShACJ4sPsxkQEnZqGBmFwJi0AEQgHCeGAAIygYBA+I4yBgUE8YChABpgPxgIj0MjEKS0TAuAAGHjGUmqIkk8mUtFYOCoMCGIA
Any help appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: