imadarchid / ucits-ma Goto Github PK
View Code? Open in Web Editor NEW๐ A better way to look at Moroccan UCITS.
Home Page: https://ucits.imadarchid.com
๐ A better way to look at Moroccan UCITS.
Home Page: https://ucits.imadarchid.com
The search bar appears to be functioning incorrectly. After careful consideration, I believe that a potential solution could be implemented in one of two ways:
I plan to draft a solution and submit a merge request as soon as possible.
Overall, I find this project to be truly impressive.
We're implementing a chart component called PerformanceChart
in Resultbox.tsx
.
ucits-ma/app/components/Resultbox.tsx
Lines 21 to 23 in a818fb9
The dataset
prop has an interface PerformanceChartProps[]
as follows:
ucits-ma/app/components/PerformanceChart.tsx
Lines 17 to 25 in a818fb9
Data is mapped from the database through Prisma, with the Prisma schema as follows for performances
:
ucits-ma/app/prisma/schema.prisma
Lines 38 to 45 in a818fb9
tsc
complains that the dataset prop cannot accept number values for string types for vl_value
and an_value
.
types of property 'vl_value' are incompatible.
Type 'number' is not assignable to type 'string'.
The issue comes from the fact that Prisma relies on Decimal.js
for the Decimal type, which for some reason ends up converting values into strings instead of numbers.
Proposed solutions
Use the Prisma.Decimal
class as a type for values vl_value
and an_value
in PerformanceType
Does not work, and throws the same error as before.
Use inferRouterOutput
to infer types from findByIsin
The whole output types are inferred. Can I access a nested object's performances
types only? (Sorry my TS skills are.. well improving?)
Convert Decimal data types for vl_value
and an_value
in Prisma to Float
We maintain consistency and errors are not thrown both from the prop side and the Chart.js side (which requires the type number
for the chart values).
Current fix
I opted for option 3, but I think it's a little messy. Is this the right path? TBD (I can't stay stuck on this issue any longer...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.