Issue 1:
This 'issue' may be behaviour by design, but I couldn't find a suitable reference to this logic anywhere. So apologies if that is the case.

$ tsc --version
message TS6029: Version 1.8.0-dev.20151105

Steps to repro:

Create empty TypeScript project in /tmp/path/to/my/project/

Create a tsconfig.json as follows:

{
"compilerOptions": {
"module": "system",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false
},
"exclude": [
"node_modules"
]
}

Create a single TypeScript file /tmp/path/to/my/project/test.ts:

import * as React from "react";

Compile with tsc. Observe the following output as expected (because we haven't installed the type definition file anywhere):

test.ts(1,24): error TS2307: Cannot find module 'react'.

What's interesting however is the output of strace:

$ strace tsc 2>&1 | grep react
read(9, "import * as React from \"react\";\n", 32) = 32
stat("/tmp/path/to/my/project/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/to/my/project/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/to/my/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/to/my/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/to/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/to/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/path/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/tmp/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/react.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)
stat("/react.d.ts", 0x7ffd985dbb00) = -1 ENOENT (No such file or directory)

i.e. in trying to resolve the non-relative import of "react", every parent directory up to and including / is considered as a potential location for either react.ts or react.d.ts.

We got bitten by this the other day because I happened to have a copy of react.d.ts kicking around in a parent directory (two directories higher) of our project. The compiler also picked up the intended version within our project, installed via tsd in a typings subdirectory. This threw a number of 'duplicate definition' errors (which in the circumstances, i.e. loading two copies of the same file, is expected behaviour).

So the unexpected behaviour here was:

walking all the way to '/'

but also the non-relative import trying to load a file in the first place given the "system" module setting (but again I could be missing something here)

Please can someone confirm whether this is by design on both counts?

Issue 2:
React's setState(state) method accepts an object with only some of the total set of keys found in a component's state but to express that in Typescript the definition of the interface passed to React.Component[Props, State] has to be somewhat sacrificed by making all fields optional (?):

interface State { stateField1?: number; stateField2?: number; }
class MyComponent extends React.Component<any, State> {
... this.setState({ stateField1: 123 }); ...
}

Better IMO would be to have some way of specifying that the argument to setState is a 'fragment' of State.

class Component<Props, State> {
...
setState(update: fragmentof State);
}

interface State { stateField1: number; stateField2: number; }
var s: State = { stateField1: 123 }; // ts error
this.setState({ stateField1: 123 }); // ts ok