File: index.d.ts

package info (click to toggle)
node-postcss-load-config 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 432 kB
  • sloc: makefile: 2; sh: 2
file content (41 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
declare const importFrom: {
	/**
	Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path.

	@param fromDirectory - Directory to import from.
	@param moduleId - What you would use in `require()`.
	@throws Like `require()`, throws when the module can't be found.

	@example
	```
	import importFrom = require('import-from');

	try {
		const bar = importFrom('foo', './bar');
		// Do something with `bar`
	} catch (error) {
		// `error` is thrown when `./bar` can't be found
	}
	```
	*/
	(fromDirectory: string, moduleId: string): unknown;

	/**
	Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path.

	@param fromDirectory - Directory to import from.
	@param moduleId - What you would use in `require()`.
	@returns `undefined` instead of throwing when the module can't be found.

	@example
	```
	import importFrom = require('import-from');

	const bar = importFrom.silent('foo', './bar');
	// Do something with `bar`, may be `undefined` when `./bar` can't be found
	```
	*/
	silent(fromDirectory: string, moduleId: string): unknown;
};

export = importFrom;