feat: add types for @rollup/plugin-virtual (#42688)

* feat: add types for @rollup/plugin-virtual

* chore: rm 'node' from 'types'

* chore: set typescript version to 2.9

* chore: set typescript version to 3.7

* chore: fix lint issues
This commit is contained in:
ed eustace
2020-02-28 10:54:59 -08:00
committed by GitHub
parent b6ffefefca
commit 0282d7255e
5 changed files with 60 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for @rollup/plugin-virtual 2.0
// Project: https://github.com/rollup/plugins/tree/master/packages/virtual#readme
// Definitions by: ed eustace <https://github.com/ahum>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7
/// <reference types="node" />
import { Plugin } from 'rollup';
declare namespace virtual {
interface Options {
[filePath: string]: string;
}
}
/**
* A Rollup plugin which loads virtual modules from memory.
*/
declare function virtual(options?: virtual.Options): Plugin;
export = virtual;
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"rollup": "^1.31.1"
}
}
@@ -0,0 +1,6 @@
import virtual = require('@rollup/plugin-virtual');
virtual(); // $ExpectType Plugin
const options: virtual.Options = { 'path/to/file': '//hi' };
virtual(options); // $ExpectType Plugin
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths" : {
"@rollup/plugin-virtual": ["rollup__plugin-virtual"]
}
},
"files": [
"index.d.ts",
"rollup__plugin-virtual-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }