Giter Site home page Giter Site logo

test-case-tsc-exports's Introduction

Reduced Test Case: How to import types.js?

This shows how exported types cannot also be used as package-scope types.

Re:

Setup

curl https://webi.sh/node | sh
source ~/.config/envman/PATH.sh

npm install --location=global jshint prettier uglify-js typescript fixjson
git clone https://gist.github.com/coolaj86/aaaf1a5c469a47d40f5f57d37ea4484f
cd ./aaaf1a5c469a47d40f5f57d37ea4484f/

Top-Level Package

tsc -p tsconfig.json

main.js:4:19 - error TS2306: File '/private/tmp/aaaf1a5c469a47d40f5f57d37ea4484f/node_modules/foo/types.js' is not a module.

4  * @param {import('foo/types.js').Foo} foo
                    ~~~~~~~~~~~~~~


Found 1 error in main.js:4

Package Foo

(
    cd ./node_modules/foo/
    tsc -p tsconfig.json
)

Package Bar

(
    cd ./node_modules/bar/
    tsc -p tsconfig.json
)

bar.js:3:12 - error TS2552: Cannot find name 'Bar'. Did you mean 'bar'?

3 /** @type {Bar} */
             ~~~

  bar.js:4:5
    4 let bar = {
          ~~~
    'bar' is declared here.


Found 1 error in bar.js:3

These are not the droids you're looking for.

To any random wanderers, try https://github.com/BeyondCodeBootcamp/js-with-types-jsdoc-tsc-starter instead.

test-case-tsc-exports's People

Contributors

coolaj86 avatar lepsch avatar

Stargazers

bella avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.