google / google/schema-dts

The WithContext type is invalid

Open
#98 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
57
PR merge metrics
No merged PRs in 30d

Description

The `WithContext` type accepts all `Thing` types:

```ts
/** Used at the top-level node to indicate the context for the JSON-LD objects used. The context provided in this type is compatible with the keys and URLs in the rest of this generated file. */
export declare type WithContext = T & {
"@context": "https://schema.org";
};
```

However, `Thing` allows `string` values. For example:

```ts
export const thing: Thing = '';
```

It's not possible to intersect `string` and `object`, which makes the `WithContext` type invalid.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.