Typings for vssln-parser (#35651)

This commit is contained in:
Erik Källén 2019-05-22 18:31:31 +02:00 committed by Ryan Cavanaugh
parent 635592e97f
commit acd1c04ea3
4 changed files with 78 additions and 0 deletions

42
types/vssln-parser/index.d.ts vendored Normal file
View File

@ -0,0 +1,42 @@
// Type definitions for vssln-parser 0.1
// Project: https://github.com/mhusseini/vssln-parser
// Definitions by: Erik Källén <https://github.com/erik-kallen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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;

View 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",
"vssln-parser-tests.ts"
]
}

View File

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

View File

@ -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
});