Add definitions for ace-diff

This commit is contained in:
Unknown
2018-04-20 17:27:18 -06:00
parent ee2f1b215e
commit 2421842822
4 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import AceDiff = require('ace-diff');
new AceDiff(); // $ExpectError
const aceDiffOpts = {
element: '.acediff',
left: { content: 'left content' },
right: { content: 'left content' },
};
new AceDiff(aceDiffOpts); // $ExpectType AceDiff
const differ = new AceDiff(aceDiffOpts);
differ.getEditors(); // $ExpectType { left: any; right: any; }
differ.setOptions(); // $ExpectType void
differ.getNumDiffs(); // $ExpectType number
differ.diff(); // $ExpectType void
differ.destroy(); // $ExpectType void

47
types/ace-diff/index.d.ts vendored Normal file
View File

@@ -0,0 +1,47 @@
// Type definitions for ace-diff 2.1
// Project: https://ace-diff.github.io/ace-diff/
// Definitions by: Mike Dodge <https://github.com/innovation-team>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace AceDiff;
export = AceDiff;
declare class AceDiff {
constructor(opts: AceDiff.AceDiffOpts);
getEditors(): {
left: any;
right: any;
};
setOptions(): void;
getNumDiffs(): number;
diff(): void;
destroy(): void;
}
declare namespace AceDiff {
interface AceDiffLROpts {
content?: string | null;
mode?: string;
theme?: string;
editable?: boolean;
copyLinkEnabled?: boolean;
}
interface AceDiffOpts {
element: string | HTMLElement;
mode?: string;
theme?: string;
diffGranularity?: 'specific' | 'broad';
showDiffs?: boolean;
showConnectors?: boolean;
maxDiffs?: number;
left: AceDiffLROpts;
right: AceDiffLROpts;
classes?: {
diff: string;
connector: string;
newCodeConnectorLinkContent: string;
deletedCodeConnectorLinkContent: string;
};
}
}

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ace-diff-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }