We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bug report
Input code
export interface Ohlc { open: number; high: number; low: number; close: number; } export interface BarValueByType { Bar: Ohlc; Line: number; } export type SeriesType = keyof BarValueByType; export function getBarValue<T extends SeriesType>(value: number, seriesType: T): BarValueByType[T] { if (seriesType === 'Bar') { return { open: value, high: value, low: value, close: value, } as BarValueByType[T]; } else { return value as BarValueByType[T]; } }
Expected output
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBarValue = void 0; function getBarValue(value, seriesType) { if (seriesType === 'Bar') { return { open: value, high: value, low: value, close: value, }; } else { return value; } } exports.getBarValue = getBarValue;
Actual output
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBarValue = void 0; function getBarValue(value, seriesType) { if (seriesType === 'Bar') { return { _internal_open: value, _internal_high: value, _internal_low: value, _internal_close: value, }; } else { return value; } } exports.getBarValue = getBarValue;
The text was updated successfully, but these errors were encountered:
Fixed wrong code for indexed generic type
9353216
Fixes #23
Successfully merging a pull request may close this issue.
Bug report
Input code
Expected output
Actual output
The text was updated successfully, but these errors were encountered: