Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import syntax not working #38

Open
penguinsAreFunny opened this issue Oct 23, 2020 · 2 comments
Open

import syntax not working #38

penguinsAreFunny opened this issue Oct 23, 2020 · 2 comments

Comments

@penguinsAreFunny
Copy link

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.

@steveukx
Copy link
Owner

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'`;

@penguinsAreFunny
Copy link
Author

Thank you veryr much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants