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.

Expected a value of type `undefined` for `author.test` but received `undefined`

See original GitHub issue
'use strict';
const { struct } = require('../lib/superstruct/lib/index');
const Article = struct({
  id: 'number',
  author: {
    id: 'number',
  },
});
const data = {
  id: 34,
  author: {
    id: 1,
    test: undefined,
  },
};
const article = Article(data);
console.log('article', article);

I use the struct to validate data from excel, some unsed keys are set to undefined, and I get an error like : Expected a value of type undefined for author.test but received undefined

I try to partial, but it is not recursive. so I create this issues and a pull request.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
saighostcommented, Feb 9, 2018

ok, maybe I replace struct struct.partial in recursive.

0reactions
ianstormtaylorcommented, Feb 9, 2018

@saighost awesome, let us know if you find any issues. Thank you for taking the time to write up that PR either way!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : expected value of type 'String!' but value is undefined
I used this code in my stelve kit app. I want to sent the email to query data from graphql. I try to...
Read more >
Zig Language Reference
This syntax tells the Zig compiler that the function will either return an error or a value. An error union type combines an...
Read more >
Documentation - TypeScript 3.7
this is a new way to say that the value foo will be used when it's “present”; but when it's null or undefined...
Read more >
LLVM Language Reference Manual
Abstract¶. This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides ......
Read more >
Solved: undefined - Power Platform Community - Microsoft
PLease help me to have null/blank value in the date column. ... expects one parameter: the object, array or string to test for...
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