ts-nameof | nameof in TypeScript | Plugin library
kandi X-RAY | ts-nameof Summary
kandi X-RAY | ts-nameof Summary
nameof in TypeScript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ts-nameof
ts-nameof Key Features
ts-nameof Examples and Code Snippets
Community Discussions
Trending Discussions on ts-nameof
QUESTION
I have a project with mocha tests that rely on ts-nameof.
The mocha tests is supported by Mocha sidebar in VSCode.
When trying to refresh my tests (in the tests sidebar) I have a ReferenceError: nameof is not defined
.
My understanding is that I have to setup Mocha sidebar to somehow use ttypescript instead of typescript (like I did with VSCode).
I know this VSCode plugin rely on ts-node since they are asking to set the VS settings
"mocha.requires": [ "ts-node/register" ]
.
I tried to look for a "tts-node" package (a ts-node like but for ttypescript), or what exactly is this "ts-node/register" and help me finding better keywords to search for, but didn't find an answer.
I tried to add "ttypescript" and "ts-nameof" in the mocha.requires, this didn't change anything.
I did find that ts-node can accept a --compiler setting that could (maybe?) be ttypescript, however, I don't know how to provide it to the Mocha sidebar plugin.
...ANSWER
Answered 2019-Aug-09 at 00:32I read the ts-node & mocha codes and found there is no way to provide the ts-node --compiler argument from mocha.
However, I found a different way to so, in the settings.json, instead of using "mocha.requires": [ "ts-node/register" ]
I use "mocha.requires": [ "./ttypescript-register.js" ]
".
Then in the root of my project I created a file ttypescript-register.js with require('./node_modules/ts-node/dist').register({compiler: "ttypescript"});
QUESTION
I am using ts-nameof within my TypeScript files as like in this .ts
-file:
ANSWER
Answered 2019-Feb-06 at 08:05Install required npm
packages
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ts-nameof
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page