-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.2.1 / nightly (2.3.0-dev.20170301)
Command
tsc try.ts --noImplicitAny
Code
try.ts
import { x } from 'test'; // error TS7016: Could not find a declaration file for module 'test'.
module test
-
package.json
{ "name": "test", "version": "1.0.0", "main": "lib/index" }
-
lib/index.js
"use strict"; exports.__esModule = true; exports.x = { test: "only" };
-
lib/index.d.ts
export interface X { test: "only"; } export declare const x: X;
Expected behavior:
non-error
Actual behavior:
try.ts(1,19): error TS7016: Could not find a declaration file for module 'test'. '~/tsc-test/node_modules/test/lib/index.js' implicitly has an 'any' type.
It works fine with typescript@2.1.6, or specified types
field in package.json
:
{
"name": "test",
"version": "1.0.0",
"main": "lib/index",
"types": "lib/index"
}
But I think this is a bug, since the documentation said:
Also note that if your main declaration file is named index.d.ts and lives at the root of the package (next to index.js) you do not need to mark the "types" property, though it is advisable to do so.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created