dsherret / ts-nameof

nameof in TypeScript
MIT License
493 stars 23 forks source link

nameof.interpolate not working in ts-nameof.macro #104

Closed foresightyj closed 4 years ago

foresightyj commented 4 years ago

I created a minimal project illustrating this bug here https://github.com/foresightyj/nameof-minimal. Just run npm run build.

Input:

const i = 1;
console.log(nameof.full(m.Data[i].Title));
console.log(nameof.full(m.Data[nameof.interpolate(i)].Title));

Output:

var i = 1;
console.log("m.Data[.i].Title");
console.log("".concat(i));

So I get only the index not the full string. Did I miss anything? Thanks.

I also tried babel-plugin-ts-nameof which yields the same result.

dsherret commented 4 years ago

Awesome! Thanks so much for the repo as I wasn't able to reproduce this in my test suite, but I investigated it and found the problem. I'll have a fix soon.

dsherret commented 4 years ago

@foresightyj ok, if you upgrade to the latest version it should be fixed now. Thanks so much for taking the time to report this and I'm happy you are using the interpolate function 🙂

foresightyj commented 4 years ago

Yes. It's working now. Thanks a lot for the quick fix, and also thanks a lot for this awesome library!