properties icon indicating copy to clipboard operation
properties copied to clipboard

import syntax not working

Open penguinsAreFunny opened this issue 4 years ago • 2 comments

Hello,

I am not sure if I am mistaken, but I have no import-syntax working for properties-reader (using TypeScript). Documentation: const propertiesReader = require("properties-reader"); // works fine const properties = propertiesReader("path");

Trying to use modern import-syntax does not work for me. import * as propertiesReader from "properties-reader"); // does not work import {PropertiesReader} from "properties-reader"; // does not work import {propertiesReader} from "properties-reader"; // does not work import {PropertiesReader} from "properties-reader/src/properties-reader"; // does not work [...]

This might not be an issue but just me not understanding why this is not working. I have looked up require to import converters, which would convert the require-statement into one of the import statements above. I think it is not working because of the unusual directory-structure of npm-properties-reader. Usually an npm module has an index.js file directly in the directory folder exporting all other visible modules.

I think it would be great if properties-reader import-syntax would be fair to conventions.

penguinsAreFunny avatar Oct 23 '20 13:10 penguinsAreFunny

Hi, at the moment this library isn't bundled with typescript types, but there are types available on npm as @types/properties-reader which are up to date with the current state of the library.

To import the library you would need to use the default import, eg:

import propertiesReader, { AppenderOptions, ... any other types here ... } from 'properties-reader'`;

steveukx avatar Oct 23 '20 14:10 steveukx

Thank you veryr much :)

penguinsAreFunny avatar Oct 27 '20 10:10 penguinsAreFunny