From acd1c04ea3397f2264fa78b5c5eec5b9de1bf954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20K=C3=A4ll=C3=A9n?= Date: Wed, 22 May 2019 18:31:31 +0200 Subject: [PATCH] Typings for vssln-parser (#35651) --- types/vssln-parser/index.d.ts | 42 ++++++++++++++++++++++++ types/vssln-parser/tsconfig.json | 23 +++++++++++++ types/vssln-parser/tslint.json | 1 + types/vssln-parser/vssln-parser-tests.ts | 12 +++++++ 4 files changed, 78 insertions(+) create mode 100644 types/vssln-parser/index.d.ts create mode 100644 types/vssln-parser/tsconfig.json create mode 100644 types/vssln-parser/tslint.json create mode 100644 types/vssln-parser/vssln-parser-tests.ts 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 +});