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.

Allow more primitives (boolean/number/string)

See original GitHub issue

E.g. in ImageObject:

  • isAccessibleForFree should be allowed to be a boolean primitive
  • width and height should be allowed to be a number primitive
  • author and contentLocation should be allowed to be a string primitive

Related: https://github.com/google/schema-dts/issues/19

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Eyascommented, Oct 25, 2019

For Booleans, to save backwards compatibility, a good shape would be:

enum BooleanEnum {
    True = "https://schema.org/True",
    False = "https://schema.org/False"
}
/** Boolean: True or False. */
export type Boolean = true | false | BooleanEnum;
export const Boolean = {
  True: BooleanEnum.True as const,
  False: BooleanEnum.False as const,
}

So you can use:

  • Boolean.True,
  • Boolean.False, as well as true and false.
0reactions
Eyascommented, Nov 13, 2019

Hm. Note that ImageObject doesn’t always work as a string, for example:

https://lists.w3.org/Archives/Public/public-schemaorg/2019Nov/0003.html

Structured Data Testing Tool rejects when “logo” is set to a string, requiring an ImageObject set explicitly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Primitive Data Types (The Java™ Tutorials > Learning the ...
boolean : The boolean data type has only two possible values: true and false . Use this data type for simple flags that...
Read more >
JavaScript data types and data structures - MDN Web Docs
Primitive values · Null type · Undefined type · Boolean type · Number type · BigInt type · String type · Symbol type....
Read more >
Default value of 'boolean' and 'Boolean' in Java - Stack Overflow
Boolean must be constructed with a boolean or a String . If the object is unintialized, it would point to null . The...
Read more >
Handbook - Basic Types - TypeScript
Tuple types allow you to express an array with a fixed number of elements whose ... non-primitive type, i.e. anything that is not...
Read more >
Methods of primitives - The Modern JavaScript Tutorial
The “object wrappers” are different for each primitive type and are called: String , Number , Boolean , Symbol and BigInt . Thus,...
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