Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Investigate adding missing typings warning #10

Closed
wmonk opened this issue Jan 2, 2017 · 3 comments
Closed

Investigate adding missing typings warning #10

wmonk opened this issue Jan 2, 2017 · 3 comments

Comments

@wmonk
Copy link
Owner

wmonk commented Jan 2, 2017

As per #8 there can be some confusion for TS beginners around missing module errors that are actually to do with missing typings. react-scripts has done a great job with making more subtle errors more digestible and obvious. So my thinking is an addition of a nicer message about installing @types/ or adding a type patch for it, with a link how to do it.

@majodev
Copy link

majodev commented Jan 23, 2017

Might be no longer needed since TypeScript 2.1: Allow untyped imports.

@nweldev
Copy link

nweldev commented Mar 17, 2017

You could add that in the init script :

if (useYarn) {
    command = 'yarnpkg';
    args = ['add'];
    devArgs = ['add', '--dev'];
  } else {
    command = 'npm';
    args = [
      'install',
      '--save',
      verbose && '--verbose'
    ].filter(function(e) { return e; });
    devArgs = [
      'install',
      '--save-dev',
      verbose && '--verbose'
    ].filter(function(e) { return e; });
  }
  args.push('react', 'react-dom');
  devArgs.push('@types/node', '@types/react', '@types/react-dom', '@types/jest');

  // Install devDependencies (typings, etc ...)
  console.log('Installing devDependencies using ' + command + '...');
  console.log();
  var devProc = spawn.sync(command, devArgs, {stdio: 'inherit'});
  if (devProc.status !== 0) {
    console.error('`' + command + ' ' + args.join(' ') + '` failed');
    return;
  }

@CraigglesO
Copy link

OOPS, posted on the wrong issue.

I am using Yarn:

I had an error that said
cannot find name ' require'

But it still ran great (to be clear, this error ran inside atom with the atom-typescript plugin)

But this fixed it (tsconfig.json):

  "compilerOptions": {
      ...
      "types": [
        "node"
      ],
      "typeRoots": [
        "node_modules/@types"
      ]
  }

I am also having an issue with cannot find name "it", (app.test.tsx) But I am sure I will find eventually and get back with you.

@wmonk wmonk added the wontfix label Apr 12, 2017
@wmonk wmonk closed this as completed Apr 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants