diff --git a/types/vssln-parser/index.d.ts b/types/vssln-parser/index.d.ts new file mode 100644 index 0000000000..174324f719 --- /dev/null +++ b/types/vssln-parser/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for vssln-parser 0.1 +// Project: https://github.com/mhusseini/vssln-parser +// Definitions by: Erik Källén +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as fs from 'fs'; + +declare function parse(input: fs.ReadStream | string, callback: (solution: parse.VsSolutionFile) => void): void; + +declare namespace parse { + interface VsSolutionFile extends VsSolutionSection, VsSolutionSectionCollection { + visualStudioVersion?: string; + minimumVisualStudioVersion?: string; + projects: VsSolutionProject[]; + solutionConfigurationPlatforms?: VsSolutionSection; + projectConfigurationPlatforms?: VsSolutionSection; + solutionProperties?: VsSolutionSection; + nestedProjects?: VsSolutionSection; + teamFoundationVersionControl?: VsSolutionSection; + } + + interface VsSolutionProject extends VsSolutionSection, VsSolutionSectionCollection { + name: string; + type: string; + projectGuid: string; + typeGuid: string; + path: string; + projectDependencies?: VsSolutionSection; + } + + interface VsSolutionSection { + [index: string]: any; + } + + interface VsSolutionSectionCollection { + [index: string]: VsSolutionSection; + } +} + +export = parse; diff --git a/types/vssln-parser/tsconfig.json b/types/vssln-parser/tsconfig.json new file mode 100644 index 0000000000..df5d8bbcdc --- /dev/null +++ b/types/vssln-parser/tsconfig.json @@ -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", + "vssln-parser-tests.ts" + ] +} diff --git a/types/vssln-parser/tslint.json b/types/vssln-parser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vssln-parser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vssln-parser/vssln-parser-tests.ts b/types/vssln-parser/vssln-parser-tests.ts new file mode 100644 index 0000000000..c63b13ddc5 --- /dev/null +++ b/types/vssln-parser/vssln-parser-tests.ts @@ -0,0 +1,12 @@ +import * as vsslnparse from 'vssln-parser'; +import * as fs from 'fs'; + +vsslnparse('', solution => { + solution.visualStudioVersion; // $ExpectType string | undefined + solution.projects[0].name; // $ExpectType string +}); + +vsslnparse(fs.createReadStream('test.sln'), solution => { + solution.visualStudioVersion; // $ExpectType string | undefined + solution.projects[0].name; // $ExpectType string +});