Skip to content

fix glob-to-regexp d.ts #49

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

Merged
merged 1 commit into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/languages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io). All rights reserved.
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import globToRegExp from "glob-to-regexp";
import globToRegExp = require('glob-to-regexp');
import {
Languages, DiagnosticCollection, CompletionItemProvider, DocumentIdentifier, HoverProvider,
SignatureHelpProvider, DefinitionProvider, ReferenceProvider, DocumentHighlightProvider,
Expand Down
4 changes: 3 additions & 1 deletion typings/glob-to-regexp/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
declare module "glob-to-regexp" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to delcare module then at all? https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html looks like we should be able to declare a function and export it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module declaration is needed if import ... from "module" syntax should stay, cf. microsoft/TypeScript#5073.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we use import x = require('module') then it should not be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it's still required.

[ts]
Could not find a declaration file for module 'glob-to-regexp'. '/Users/tugarev/Projects/monaco-languageclient/node_modules/glob-to-regexp/index.js' implicitly has an 'any' type.
Try npm install @types/glob-to-regexp if it exists or add a new declaration (.d.ts) file containing declare module 'glob-to-regexp';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double-checked that, it's required if types should be imported, right? module-function.d.ts seems to be misleading.

export default function globToRegExp(glob: string, opts?: {
namespace globToRegExp {}
function globToRegExp(glob: string, opts?: {
extended?: boolean;
globstar?: boolean;
flags?: string;
}): RegExp;
export = globToRegExp;
}