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

fix: type directives import #2910

Merged
merged 7 commits into from
Sep 11, 2019
Merged

Conversation

bartlomieju
Copy link
Member

Fixes #2909

I'm not sure about the test though

CC @kitsonk

js/type_directives.ts Outdated Show resolved Hide resolved
js/type_directives.ts Outdated Show resolved Hide resolved
tests/type_definitions.ts Show resolved Hide resolved
Copy link
Contributor

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

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

LGTM

@axetroy
Copy link
Contributor

axetroy commented Sep 11, 2019

Should we add test cases to ensure that the parsing of the directives is correct?

eg.

interface TestCase {
  input: string;
  output?: DirectiveInfo;
  error?: string;
}

test(() => {
  // defined testcase
  const testcases = [
    {
      input: "// some typescript code",
      output: undefined
    },
    {
      input: `// @deno-types="./foo.d.ts"`,
      output: {
        path: "...",
        start: 0,
        end: 0
      }
    }
  ];

  for (const testcase of testcases) {
    // run parser function
  }
});

@kitsonk
Copy link
Contributor

kitsonk commented Sep 11, 2019

@axetroy at the moment we don't have unit tests for the compiler and related modules, mostly because they have no run-time presence to access via the unit tests... we are getting to the point though where that will become possible to load the modules in the runtime and unit test them, but I see adding (actually restoring) that functionality to be seperate from this PR.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM

@ry ry merged commit a4e1d7d into denoland:master Sep 11, 2019
@bartlomieju bartlomieju deleted the fix-type_directives_import branch September 11, 2019 10:59
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

Successfully merging this pull request may close these issues.

bug: Type definitions not working with import "./a.d.ts" syntax
4 participants