Implements GenericDataExtractionProviderFactory. With this, the debug visualizer can be used with every language that can be debugged in VS Code.
This commit is contained in:
@@ -4,7 +4,9 @@ export type DataExtractionResult = {
|
||||
availableExtractors: DataExtractorInfo[];
|
||||
};
|
||||
|
||||
// Instances must be valid json values.
|
||||
/**
|
||||
* Instances must be valid json values.
|
||||
*/
|
||||
export type ExtractedData = {
|
||||
kind: Record<string, true>;
|
||||
};
|
||||
@@ -18,3 +20,16 @@ export type DataExtractorInfo = {
|
||||
export type DataExtractorId = {
|
||||
__brand: "DataExtractorId";
|
||||
} & string;
|
||||
|
||||
export function isExtractedData(val: unknown): val is ExtractedData {
|
||||
if (typeof val !== "object" || !val || !("kind" in val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const obj = val as any;
|
||||
if (typeof obj.kind !== "object" || !obj.kind) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Object.values(obj.kind).every(val => val === true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user