How to use the tsd.VersionMatcher function in tsd

To help you get started, we’ve selected a few tsd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moznion / gulp-tsd / lib / tsd.js View on Github external
var query;

            opts.saveBundle = true;
            opts.overwriteFiles = true;
            opts.resolveDependencies = true;

            logger.log('latest:', isLatest);
            logger.log('running...');
            if (isLatest) {
                opts.saveToConfig = true;
                query = new tsd.Query();
                api.context.config.getInstalled().forEach(function (inst) {
                    var def = tsd.Def.getFrom(inst.path);
                    query.addNamePattern(def.project + '/' + def.name);
                });
                query.versionMatcher = new tsd.VersionMatcher('latest');

                return api.select(query, opts).then(function (selection) {
                    return api.install(selection, opts);
                });
            }
            return api.reinstall(opts);
        });
    }
github DefinitelyTyped / grunt-tsd / lib / runner.js View on Github external
return api.readConfig(options.config, true).then(function () {
			var opts = tsd.Options.fromJSON(options.opts);
			opts.overwriteFiles = true;
			opts.resolveDependencies = true;
			opts.saveToConfig = true;

			if (options.latest) {
				var query = new tsd.Query();
				api.context.config.getInstalled().forEach(function (inst) {
					var def = tsd.Def.getFrom(inst.path);
					query.addNamePattern(def.project + '/' + def.name);
				});
				query.versionMatcher = new tsd.VersionMatcher('latest');

				return api.select(query, opts).then(function (selection) {
					return api.install(selection, opts);
				});
			}
			return api.reinstall(opts);
		});
	}

tsd

Check TypeScript type definitions

MIT
Latest version published 4 months ago

Package Health Score

80 / 100
Full package analysis