When using TypeScript version 5.1.3, an error occurs while trying to parse an HTML string like ogs({html}) as shown in the HTML Example. The error message received is as follows:
Argument of type '{ html: string; }' is not assignable to parameter of type 'OpenGraphScraperOptions'.
Property 'url' is missing in type '{ html: string; }' but required in type 'OpenGraphScraperOptions'.ts(2345)
However, an attempt to rectify this issue by providing both url and html results in a new error at runtime:
Must specify either `url` or `html`, not both
Steps to Reproduce
The error can be reproduced using the following code snippet:
import ogs from 'open-graph-scraper';
const { result } = await ogs({ html });
This code triggers the aforementioned error message:
Argument of type '{ html: string; }' is not assignable to parameter of type 'OpenGraphScraperOptions'.
Property 'url' is missing in type '{ html: string; }' but required in type 'OpenGraphScraperOptions'.ts(2345)
Expected Behavior
No error should be thrown and the parsing should proceed as intended.
Actual Behavior
Instead of the expected behavior, the error stated above is thrown.
Additional Information
This issue is experienced while using the OpenGraphScraper library, version 6.1.0.
Description
When using TypeScript version 5.1.3, an error occurs while trying to parse an HTML string like
ogs({html})
as shown in the HTML Example. The error message received is as follows:However, an attempt to rectify this issue by providing both
url
andhtml
results in a new error at runtime:Steps to Reproduce
The error can be reproduced using the following code snippet:
This code triggers the aforementioned error message:
Expected Behavior
No error should be thrown and the parsing should proceed as intended.
Actual Behavior
Instead of the expected behavior, the error stated above is thrown.
Additional Information
This issue is experienced while using the OpenGraphScraper library, version 6.1.0.