Skip to content
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

ERROR: ts_transformer_keys_1.keys is not a function #13

Closed
gbbarroso opened this issue Apr 26, 2018 · 1 comment
Closed

ERROR: ts_transformer_keys_1.keys is not a function #13

gbbarroso opened this issue Apr 26, 2018 · 1 comment

Comments

@gbbarroso
Copy link

Not sure if it is my fault or not, but I'm using the README's example and getting this error:

const keysOfProps = keys<Props>();
                    ^
TypeError: ts_transformer_keys_1.keys is not a function
    at Object.<anonymous> (C:\Users\Gabriel\Projects\typescript-proj\index.ts:8:21)
    at Module._compile (module.js:649:30)
    at Module.m._compile (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:402:23)
    at Module._extensions..js (module.js:660:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:405:12)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
    at Object.<anonymous> (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\ts-node\src\bin.ts:145:12)

I have these dependencies:

  "dependencies": {
    "ts-transformer-keys": "^0.3.1",
    "typescript": "^2.8.3"
  }

My code:

import { keys } from 'ts-transformer-keys';

interface Props {
  id: string;
  name: string;
  age: number;
}
const keysOfProps = keys<Props>();

console.log(keysOfProps); // ['id', 'name', 'age']

Thanks in advance

@kimamula
Copy link
Owner

kimamula commented Apr 26, 2018

I reopened #4 to avoid duplicates as it seems that many people are encountering this error.

I would like to know how you are using the custom transformer to compile the keys function.
The example usage of the custom transformer is written here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants