Skip to content

Commit

Permalink
add explicit .ts extensions to imports
Browse files Browse the repository at this point in the history
typescript should not enforce this

hopefully microsoft/TypeScript#27481
will get addressed
  • Loading branch information
snd committed May 13, 2019
1 parent 4408b70 commit 1fcfb04
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 21 deletions.
6 changes: 4 additions & 2 deletions src/ast-helpers.ts
Expand Up @@ -5,11 +5,13 @@

import {
Ast,
} from "./parser-combinators";
// @ts-ignore
} from "./parser-combinators.ts";

import {
escapeStringForRegex,
} from "./helpers";
// @ts-ignore
} from "./helpers.ts";

/**
* converts an array of AST nodes `nodes` representing a parsed url-pattern into
Expand Down
6 changes: 4 additions & 2 deletions src/parser.ts
Expand Up @@ -13,11 +13,13 @@ import {
newRegexParser,
newStringParser,
Parser,
} from "./parser-combinators";
// @ts-ignore
} from "./parser-combinators.ts";

import {
IOptions,
} from "./options";
// @ts-ignore
} from "./options.ts";

export function newEscapedCharParser(options: IOptions): Parser<Ast<any>> {
return newPickNthParser(1, newStringParser(options.escapeChar), newRegexParser(/^./));
Expand Down
15 changes: 10 additions & 5 deletions src/url-pattern.ts
@@ -1,26 +1,31 @@
import {
indexOfDuplicateElement,
regexGroupCount,
} from "./helpers";
// @ts-ignore
} from "./helpers.ts";

import {
Ast,
} from "./parser-combinators";
// @ts-ignore
} from "./parser-combinators.ts";

import {
defaultOptions,
IUserInputOptions,
} from "./options";
// @ts-ignore
} from "./options.ts";

import {
newUrlPatternParser,
} from "./parser";
// @ts-ignore
} from "./parser.ts";

import {
astRootToRegexString,
astToNames,
stringify,
} from "./ast-helpers";
// @ts-ignore
} from "./ast-helpers.ts";

export default class UrlPattern {
public readonly isRegex: boolean;
Expand Down
9 changes: 6 additions & 3 deletions test/ast-helpers.ts
Expand Up @@ -3,16 +3,19 @@ import * as tape from "tape";

import {
newUrlPatternParser,
} from "../src/parser";
// @ts-ignore
} from "../src/parser.ts";

import {
astRootToRegexString,
astToNames,
} from "../src/ast-helpers";
// @ts-ignore
} from "../src/ast-helpers.ts";

import {
defaultOptions,
} from "../src/options";
// @ts-ignore
} from "../src/options.ts";

const parse: any = newUrlPatternParser(defaultOptions);

Expand Down
3 changes: 2 additions & 1 deletion test/errors.ts
@@ -1,7 +1,8 @@
/* tslint:disable:no-unused-expression */
import * as tape from "tape";

import UrlPattern from "../src/url-pattern";
// @ts-ignore
import UrlPattern from "../src/url-pattern.ts";

const UntypedUrlPattern: any = UrlPattern;

Expand Down
3 changes: 2 additions & 1 deletion test/helpers.ts
Expand Up @@ -4,7 +4,8 @@ import {
escapeStringForRegex,
indexOfDuplicateElement,
regexGroupCount,
} from "../src/helpers";
// @ts-ignore
} from "../src/helpers.ts";

tape("escapeStringForRegex", (t: tape.Test) => {
const expected = "\\[\\-\\/\\\\\\^\\$\\*\\+\\?\\.\\(\\)\\|\\[\\]\\{\\}\\]";
Expand Down
3 changes: 2 additions & 1 deletion test/match-fixtures.ts
Expand Up @@ -3,7 +3,8 @@
// tslint:disable:max-line-length
import * as tape from "tape";

import UrlPattern from "../src/url-pattern";
// @ts-ignore
import UrlPattern from "../src/url-pattern.ts";

tape("match", (t: tape.Test) => {
let pattern = new UrlPattern("/foo");
Expand Down
3 changes: 2 additions & 1 deletion test/misc.ts
@@ -1,6 +1,7 @@
import * as tape from "tape";

import UrlPattern from "../src/url-pattern";
// @ts-ignore
import UrlPattern from "../src/url-pattern.ts";

tape("instance of UrlPattern is handled correctly as constructor argument", (t: tape.Test) => {
const pattern = new UrlPattern("/user/:userId/task/:taskId");
Expand Down
3 changes: 2 additions & 1 deletion test/parser-combinators.ts
Expand Up @@ -3,7 +3,8 @@ import * as tape from "tape";
import {
newRegexParser,
newStringParser,
} from "../src/parser-combinators";
// @ts-ignore
} from "../src/parser-combinators.ts";

tape("newStringParser", (t: tape.Test) => {
const parse = newStringParser("foo");
Expand Down
6 changes: 4 additions & 2 deletions test/parser.ts
Expand Up @@ -5,11 +5,13 @@ import {
newNamedWildcardParser,
newStaticContentParser,
newUrlPatternParser,
} from "../src/parser";
// @ts-ignore
} from "../src/parser.ts";

import {
defaultOptions,
} from "../src/options";
// @ts-ignore
} from "../src/options.ts";

const parse = newUrlPatternParser(defaultOptions);
const parseNamedSegment = newNamedSegmentParser(defaultOptions);
Expand Down
3 changes: 2 additions & 1 deletion test/readme.ts
Expand Up @@ -2,7 +2,8 @@

import * as tape from "tape";

import UrlPattern from "../src/url-pattern";
// @ts-ignore
import UrlPattern from "../src/url-pattern.ts";

tape("match a pattern against a string and extract values", (t: tape.Test) => {
const pattern = new UrlPattern("/api/users(/:id)");
Expand Down
3 changes: 2 additions & 1 deletion test/stringify-fixtures.ts
Expand Up @@ -2,7 +2,8 @@

import * as tape from "tape";

import UrlPattern from "../src/url-pattern";
// @ts-ignore
import UrlPattern from "../src/url-pattern.ts";

tape("stringify", (t: tape.Test) => {
let pattern = new UrlPattern("/foo");
Expand Down

0 comments on commit 1fcfb04

Please sign in to comment.