Hello, i got some trouble with formating polymorphic variant, here is the ocde:
type httpStatus = @int
[
| @as(100) #CONTINUE
| @as(101) #SWITCHING_PROTOCOLS
| @as(200) #OK
| @as(201) #CREATED
| @as(202) #ACCEPTED
| @as(203) #NONAUTHORITATIVE_INFORMATION
| @as(204) #NO_CONTENT
| @as(205) #RESET_CONTENT
| @as(206) #PARTIAL_CONTENT
| @as(300) #MULTIPLE_CHOICES
| @as(301) #MOVED_PERMANENTLY
| @as(302) #FOUND
| @as(303) #SEE_OTHER
| @as(304) #NOT_MODIFIED
| @as(307) #TEMPORARY_REDIRECT
| @as(308) #PERMANENT_REDIRECT
| @as(400) #BAD_REQUEST
| @as(401) #UNAUTHORIZED
| @as(403) #FORBIDDEN
| @as(404) #NOT_FOUND
| @as(405) #METHOD_NOT_ALLOWED
| @as(406) #NOT_ACCEPTABLE
| @as(407) #PROXY_AUTHENTICATION_REQUIRED
| @as(408) #REQUEST_TIMEOUT
| @as(409) #CONFLICT
| @as(410) #GONE
| @as(411) #LENGTH_REQUIRED
| @as(412) #PRECONDITION_FAILED
| @as(413) #PAYLOAD_TOO_LARGE
| @as(414) #URI_TOO_LONG
| @as(415) #UNSUPPORTED_MEDIA_TYPE
| @as(416) #RANGE_NOT_SATISFIABLE
| @as(417) #EXPECTATION_FAILED
| @as(418) #IM_A_TEAPOT
| @as(422) #UNPROCESSABLE_ENTITY
| @as(424) #FAILED_DEPENDENCY
| @as(425) #TOO_EARLY
| @as(426) #UPGRADE_REQUIRED
| @as(428) #PRECONDITION_REQUIRED
| @as(429) #TOO_MANY_REQUESTS
| @as(431) #REQUEST_HEADER_FIELDS_TOO_LARGE
| @as(451) #UNAVAILABLE_FOR_LEGAL_REASONS
| @as(500) #INTERNAL_SERVER_ERROR
| @as(501) #NOT_IMPLEMENTED
| @as(502) #BAD_GATEWAY
| @as(503) #SERVICE_UNAVAILABLE
| @as(504) #GATEWAY_TIMEOUT
| @as(505) #HTTP_VERSION_NOT_SUPPORTED
| @as(511) #NETWORK_AUTHENTICATION_REQUIRED
]
As you can see, i want to create a polymorphic variant from http status code, but when looking at the generated JS, it is like the decorators @as
and @int
are not working, since i always get the string version of the variant:
someFunc(#OK)
becomes someFunc("OK")
instead of someFunc(200)
Do you have any idea why ??