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.

about partial struct

See original GitHub issue

from reference:

partial structs are similar to object structs, but they only require that the specified properties exist, and they don’t care about other properties on the object.


but when i try this

test = { a: 1, b: 2, c: 3 }
struct = partial({ a: number(), b: number() })
assert(test, struct)

it throws: Expected a value of type `never` for `c` but received `3`. i’m expecting it to not throw error. sorry for my bad english

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
mikestopcontinuescommented, Sep 4, 2020

Thanks @hixus . So just to clarify, if only for myself:

  • Shape/Object - Object has all of the defined keys and no others
  • Type - Object has all of the defined keys and maybe others
  • Partial - Object has some of the defined keys and no others
  • [Nonexistent] - Object has some of the defined keys and maybe others
1reaction
albertgronholmcommented, Aug 7, 2020

So “partial” just simply doesn’t work at all like it’s supposed to? Is there any way I can reach similar behavior by doing something else? Any timeline for a fix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Partial structs | 2,000 Things You Should Know About C#
A partial method in a partial struct is a method that is declared in one portion of the struct and, optionally, implemented in...
Read more >
Partial Classes and Methods - C# Programming Guide
A partial class or struct may contain a partial method. One part of the class contains the signature of the method. An implementation...
Read more >
Partial Class, Interface or Struct in C Sharp with example
If any part is declared abstract, then the whole class, interface or struct is considered abstract.
Read more >
C# Partial Classes and Methods - TutorialsTeacher
In C#, you can split the implementation of a class, a struct, a method, or an interface in multiple .cs files using the...
Read more >
asp.net - Is it possible to have "inherited partial structs" in c
You can't inherit from structs, ever - and partial types don't inherit from each other anyway. They're just multiple source files combined ...
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