question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decoder with constants is throwing an exception. TypeError: (0 , _Result.Ok) is not a function

See original GitHub issue

When trying to decode a string to one of 3 constants, am receiving an error TypeError: (0 , _Result.Ok) is not a function

Codepen example (open browser console to see error).

Snippet:

import { guard, either3, constant, Decoder } from "decoders";

const statusDecoder: Decoder<'complete' | 'closed' | 'failed'>
      = either3(constant<'complete'>('complete'), constant<'closed'>('closed'), constant<'failed'>('failed'));

const statusString = 'closed';

const status = guard(statusDecoder)(statusString);

console.log('Decoded:', status);

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Jaywaacommented, Jun 21, 2021

It just seems to break with the snowpack dev server (and skypack.dev). It works on my production environment so assume it has something to do with how they handle package caching / module reloading. Closing this issue because it seems like more of a “them” issue. Thanks for the awesome package @nvie.

0reactions
nviecommented, Jun 21, 2021

Thx for taking the time to report a potential bug!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR TypeError: data.slice is not a function - Stack Overflow
This error is due to the array returned by your webservice. result contains the array of data. To avoid data.slice is not a...
Read more >
Exception Handling — Python 3.11.1 documentation
When a function must fail because some function it called failed, it generally doesn't set the error indicator; the function it called already...
Read more >
Errors | Node.js v19.3.0 Documentation
A JavaScript exception is a value that is thrown as a result of an invalid operation or as the target of a throw...
Read more >
Python Exceptions (With Examples) - Programiz
In this tutorial, we will learn about exceptions in Python. We will cover exceptions and different types of exceptions in Python.
Read more >
Error Types in Python - TutorialsTeacher
TypeError. The TypeError is thrown when an operation or function is applied to an object of an inappropriate type. Example: TypeError.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found