mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add typings for Kythe schema objects (#35644)
This commit is contained in:
parent
c0a7ca952f
commit
84f7012fdd
43
types/kythe/index.d.ts
vendored
Normal file
43
types/kythe/index.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Type definitions for non-npm package Kythe 0.0
|
||||
// Project: https://github.com/kythe/kythe
|
||||
// Definitions by: Ayaz Hafiz <https://github.com/ayazhafiz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* A VName (Vector Name) for a node in the Kythe schema consists of:
|
||||
* - `signature`: a unique, opaque signature for a node
|
||||
* - `corpus`: a collection of related files the node is defined in
|
||||
* - `root`: a label denoting a distinct subset of the corpus
|
||||
* - `path`: the relative path of the file containing the node
|
||||
* - `language`: programming language the node belongs to
|
||||
*/
|
||||
export interface VName {
|
||||
signature: string;
|
||||
corpus: string;
|
||||
root: string;
|
||||
path: string;
|
||||
language: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Entry in the Kythe schema is either a Fact or an Edge that describes at least one node.
|
||||
*/
|
||||
export interface Entry {
|
||||
source: VName;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Fact is an Entry that also has a fact `value`.
|
||||
*/
|
||||
export interface Fact extends Entry {
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Edge is an Entry that also has a `target` and an edge `kind`.
|
||||
*/
|
||||
export interface Edge extends Entry {
|
||||
target: VName;
|
||||
kind: string;
|
||||
}
|
||||
40
types/kythe/kythe-tests.ts
Normal file
40
types/kythe/kythe-tests.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import { VName, Fact, Edge } from "kythe";
|
||||
|
||||
const vname: VName = {
|
||||
signature: "sig#0",
|
||||
corpus: "types",
|
||||
root: "",
|
||||
path: "tests",
|
||||
language: "typescript",
|
||||
};
|
||||
|
||||
const fact: Fact = {
|
||||
source: vname,
|
||||
label: "fact",
|
||||
value: "complete",
|
||||
};
|
||||
|
||||
const edge: Edge = {
|
||||
source: vname,
|
||||
target: vname,
|
||||
kind: "edge",
|
||||
label: "fact",
|
||||
};
|
||||
|
||||
const incompleteVName: VName = { // $ExpectError
|
||||
signature: "sig#0",
|
||||
root: "",
|
||||
language: "typescript"
|
||||
};
|
||||
|
||||
const incompleteFact: Fact = {
|
||||
source: vname,
|
||||
label: "incomplete",
|
||||
kind: "notEdge", // $ExpectError
|
||||
};
|
||||
|
||||
const incompleteEdge: Edge = {
|
||||
source: vname,
|
||||
target: vname,
|
||||
value: "notFact", // $ExpectError
|
||||
};
|
||||
23
types/kythe/tsconfig.json
Normal file
23
types/kythe/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"kythe-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/kythe/tslint.json
Normal file
1
types/kythe/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user