ts-transformer-keys icon indicating copy to clipboard operation
ts-transformer-keys copied to clipboard

(0 , _tsTransformerKeys.keys) is not a function

Open yangfei4913438 opened this issue 2 years ago • 28 comments

Hi there!

I have encountered some problems.

error message

image

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

yangfei4913438 avatar Apr 27 '22 04:04 yangfei4913438

Try setting your dev dependency to match the library (npm i [email protected] --save-dev) - we had a similar issue in our backend.

elilondon avatar Apr 29 '22 20:04 elilondon

@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 avatar May 08 '22 09:05 kimamula

@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.

elilondon avatar May 08 '22 13:05 elilondon

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"

ThomazAquino avatar May 17 '22 12:05 ThomazAquino

Same for me!

image

  "dependencies": {
    "ts-transformer-keys": "^0.4.3",
    "typescript": "^4.6.4"
  },

MADEiN83 avatar May 24 '22 13:05 MADEiN83

same error

andrei0807 avatar May 26 '22 03:05 andrei0807

same error "typescript": "^4.6.3" Can please someone help with solution?

KozinaAnatolii avatar May 26 '22 23:05 KozinaAnatolii

Same error

aximut avatar Jun 23 '22 15:06 aximut

Same error here!

image
"react": "^18.2.0"
"typescript": "^4.7.4"

IvanMollOSF avatar Jul 28 '22 16:07 IvanMollOSF

Same error

SleepDevil avatar Aug 30 '22 13:08 SleepDevil

Same error :/ please help

Waldimp avatar Oct 07 '22 16:10 Waldimp

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"

AnonymousArthur avatar Dec 14 '22 09:12 AnonymousArthur

+1

BRAVO68WEB avatar Dec 19 '22 10:12 BRAVO68WEB

+1

AntoninoBonanno avatar Dec 29 '22 15:12 AntoninoBonanno

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"

lamaks avatar Jan 03 '23 21:01 lamaks

+1

zarnoevic avatar Feb 05 '23 18:02 zarnoevic

+1

roman-ternovyi avatar Feb 18 '23 22:02 roman-ternovyi

+1

171h avatar Mar 11 '23 14:03 171h

+1

thenglong avatar Apr 05 '23 02:04 thenglong

+1

davegulati avatar Apr 29 '23 05:04 davegulati

+1

Kn3cht avatar May 04 '23 11:05 Kn3cht

+1

chenzesam avatar May 24 '23 08:05 chenzesam

+1

Dimfred avatar Jun 24 '23 08:06 Dimfred

+1

chirag3003 avatar Jun 24 '23 08:06 chirag3003

+1 with "typescript": "5.1.3", "@types/node": "20.3.1", "@types/react": "18.2.12",

phungvansyhb avatar Jul 06 '23 03:07 phungvansyhb

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.

MathijsBlok avatar Aug 17 '23 14:08 MathijsBlok

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!

mwmw7 avatar Oct 01 '23 14:10 mwmw7

+1

CaseyHaralson avatar Aug 03 '24 17:08 CaseyHaralson