mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #25850 from team-innovation/ace-diff
Add definitions for ace-diff
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import AceDiff = require('ace-diff');
|
||||
|
||||
new AceDiff(); // $ExpectError
|
||||
|
||||
const aceDiffConstructorOpts = {
|
||||
element: '.acediff',
|
||||
left: { content: 'left content' },
|
||||
right: { content: 'right content' },
|
||||
};
|
||||
new AceDiff(aceDiffConstructorOpts); // $ExpectType AceDiff
|
||||
|
||||
const differ = new AceDiff(aceDiffConstructorOpts);
|
||||
|
||||
differ.getEditors(); // $ExpectType { left: any; right: any; }
|
||||
differ.setOptions(); // $ExpectError
|
||||
const aceDiffOpts = {
|
||||
diffGranularity: 'broad' as 'broad', // workaround: cast to avoid https://github.com/Microsoft/TypeScript/issues/11465#issuecomment-252453037
|
||||
};
|
||||
differ.setOptions(aceDiffOpts); // $ExpectType void
|
||||
differ.getNumDiffs(); // $ExpectType number
|
||||
differ.diff(); // $ExpectType void
|
||||
differ.destroy(); // $ExpectType void
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// 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.AceDiffConstructorOpts);
|
||||
getEditors(): {
|
||||
left: any;
|
||||
right: any;
|
||||
};
|
||||
setOptions(options: AceDiff.AceDiffOpts): void;
|
||||
getNumDiffs(): number;
|
||||
diff(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
declare namespace AceDiff {
|
||||
interface AceDiffLROpts {
|
||||
content?: string | null;
|
||||
mode?: string;
|
||||
theme?: string;
|
||||
editable?: boolean;
|
||||
copyLinkEnabled?: boolean;
|
||||
}
|
||||
|
||||
interface AceDiffConstructorOpts extends AceDiffOpts {
|
||||
element: string | HTMLElement;
|
||||
left: AceDiffLROpts;
|
||||
right: AceDiffLROpts;
|
||||
}
|
||||
|
||||
interface AceDiffOpts {
|
||||
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;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user