ts-transformer-keys
ts-transformer-keys copied to clipboard
(0 , _tsTransformerKeys.keys) is not a function
Hi there!
I have encountered some problems.
error message
run code
import { keys } from "ts-transformer-keys";
interface Props {
id: string;
name: string;
age: number;
}
const keysOfProps = keys<Props>();
console.log(keysOfProps);
env
- react: 18.0.0
- typescript: 4.6.3
link
https://codesandbox.io/s/ts-transformer-keys-stv98v
Try setting your dev dependency to match the library (npm i [email protected] --save-dev) - we had a similar issue in our backend.
@yangfei4913438 Your CodeSandbox code is neither using keys
function nor the transformer of ts-transformer-keys. Could you provide a complete reproduction?
@elilondon I have upgraded the dev dependency of TypeScript to the latest (4.6.4) in this repo and it seems all the examples in this repo are working fine with the latest version of TypeScript. If you could provide a reproduction for the issue you encountered, that would be very helpful :)
@kimamula Thanks a lot for upgrading! Will make sure to test with the latest version in our project. Our error was not exactly the same as his but more related to an injection issue. Something like "ts_transformer_keys_1 is not defined" which is a reference to the readme which was strange. Changing our dev dependency to match what you had fixed the issue.
Same issue here:
core.mjs:6494 ERROR Error: Uncaught (in promise): TypeError: (0 , ts_transformer_keys__WEBPACK_IMPORTED_MODULE_0__.keys) is not a function TypeError: (0 , ts_transformer_keys__WEBPACK_IMPORTED_MODULE_0__.keys) is not a function
Package.json: "@angular/compiler": "~13.3.1", "@angular/core": "~13.3.1", "ts-transformer-keys": "^0.4.3", "typescript": "^4.6.3"
Same for me!
"dependencies": {
"ts-transformer-keys": "^0.4.3",
"typescript": "^4.6.4"
},
same error
same error "typescript": "^4.6.3" Can please someone help with solution?
Same error
Same error here!

"react": "^18.2.0"
"typescript": "^4.7.4"
Same error
Same error :/ please help
Same error TypeError: (0 , ts_transformer_keys__WEBPACK_IMPORTED_MODULE_19__.keys) is not a function
"vue": "^3.0.0" "webpack": "5.69.0" "typescript": "4.8.4"
+1
+1
For one who using ttsc updating ttypescript to 1.5.15 version may solve the issue.
"@types/node": "^16.18.11",
"ts-transformer-keys": "^0.4.4",
"ttypescript": "^1.5.15",
"typescript": "^4.9.4"
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1 with "typescript": "5.1.3", "@types/node": "20.3.1", "@types/react": "18.2.12",
Had the same issue until i came to the conclusion that i just didn't read everything. Read the part about "How to use the custom transformer". So for my nodeJS project i had to add https://github.com/cevek/ttypescript and configure the transformer and everything worked.
For one who using ttsc updating ttypescript to 1.5.15 version may solve the issue.
"@types/node": "^16.18.11", "ts-transformer-keys": "^0.4.4", "ttypescript": "^1.5.15", "typescript": "^4.9.4"
I just use this "ttypescript": "^1.5.15", And it works!
+1