Title: Bug: @type array causes TypeError in JSON-LD parsing · Issue #1 · JavaScriptSolidServer/solid-shim · GitHub
Open Graph Title: Bug: @type array causes TypeError in JSON-LD parsing · Issue #1 · JavaScriptSolidServer/solid-shim
X Title: Bug: @type array causes TypeError in JSON-LD parsing · Issue #1 · JavaScriptSolidServer/solid-shim
Description: Description When JSON-LD uses an array for @type (which is valid per the JSON-LD spec), solid-shim throws a TypeError because it assumes @type is always a string. Error TypeError: i.@type.replace is not a function Reproduction Use any JS...
Open Graph Description: Description When JSON-LD uses an array for @type (which is valid per the JSON-LD spec), solid-shim throws a TypeError because it assumes @type is always a string. Error TypeError: i.@type.replace i...
X Description: Description When JSON-LD uses an array for @type (which is valid per the JSON-LD spec), solid-shim throws a TypeError because it assumes @type is always a string. Error TypeError: i.@type.replace i...
Opengraph URL: https://github.com/JavaScriptSolidServer/solid-shim/issues/1
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: @type array causes TypeError in JSON-LD parsing","articleBody":"## Description\n\nWhen JSON-LD uses an array for `@type` (which is valid per the JSON-LD spec), solid-shim throws a TypeError because it assumes `@type` is always a string.\n\n## Error\n\n```\nTypeError: i.@type.replace is not a function\n```\n\n## Reproduction\n\nUse any JSON-LD with an array type:\n\n```json\n{\n \"@context\": [\"https://www.w3.org/2018/credentials/v1\"],\n \"@type\": [\"VerifiableCredential\", \"UniversityDegreeCredential\"],\n ...\n}\n```\n\n## Root Cause\n\nIn `src/index.ts` line 45:\n\n```typescript\nif (node['@type']) {\n const typeUri = node['@type'].replace('schema:', 'http://schema.org/')\n targetStore.add(subject, $rdf.sym(RDF_TYPE), $rdf.sym(typeUri))\n}\n```\n\nThis assumes `@type` is a string, but JSON-LD allows arrays.\n\n## Suggested Fix\n\n```typescript\nif (node['@type']) {\n const types = Array.isArray(node['@type']) ? node['@type'] : [node['@type']]\n types.forEach(t =\u003e {\n const typeUri = t.replace('schema:', 'http://schema.org/')\n targetStore.add(subject, $rdf.sym(RDF_TYPE), $rdf.sym(typeUri))\n })\n}\n```\n\nThis handles both string and array `@type` values correctly.\n\n## Context\n\nDiscovered while building a W3C Verifiable Credentials demo for jsonos. VCs commonly use type arrays like `[\"VerifiableCredential\", \"UniversityDegreeCredential\"]`.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-01-06T21:33:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1/solid-shim/issues/1"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f342a10b-0b5e-d4c5-2544-aaa20ffd77b8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC2C:2EA41:55715B4:6E9442F:697622AC |
| html-safe-nonce | cc81a7c54ea30ac417b505c0b2cf12ea19af4aeb3bb7dbe3d10db88743d47cc5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzJDOjJFQTQxOjU1NzE1QjQ6NkU5NDQyRjo2OTc2MjJBQyIsInZpc2l0b3JfaWQiOiIzODEyMzA2ODQ0NTA0MTcxMTgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 646ea1f46578cb9c066cfcd19a35ef26b945ac518c6e81916415aecfe93c6e00 |
| hovercard-subject-tag | issue:3786611952 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/solid-shim/1/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5205160f5514e6557738cf90320173873bd6869b96dbbe89fd9af2c61a6843b7/JavaScriptSolidServer/solid-shim/issues/1 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5205160f5514e6557738cf90320173873bd6869b96dbbe89fd9af2c61a6843b7/JavaScriptSolidServer/solid-shim/issues/1 |
| og:image:alt | Description When JSON-LD uses an array for @type (which is valid per the JSON-LD spec), solid-shim throws a TypeError because it assumes @type is always a string. Error TypeError: i.@type.replace i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6814b4cc7afd45cd6e64525d0cff0e76dd802f315a5b0e55a7abda1d1d070d0 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/solid-shim git https://github.com/JavaScriptSolidServer/solid-shim.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 1125206031 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/solid-shim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1125206031 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/solid-shim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4ea235bfed58ef16c8a5642b3ac64b74f10c9f52 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width