forked from tsdjs/tsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow omitting
types
property for non-barrel main
Allow omitting `types` property for non-barrel main when `.d.ts` file name matches `main`. Fixes tsdjs#84
- Loading branch information
1 parent
fc871a1
commit e5bfb3a
Showing
14 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
source/test/fixtures/no-explicit-types-property/with-main-barrel/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {expectType, expectError} from '../../../..'; | ||
import one from './'; | ||
|
||
expectType<string>(one('foo', 'bar')); | ||
expectType<number>(one(1, 2)); | ||
expectError(one(1, 2)); |
7 changes: 7 additions & 0 deletions
7
source/test/fixtures/no-explicit-types-property/with-main-barrel/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "foo", | ||
"main": "index.js", | ||
"files": [ | ||
"index.d.ts" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
source/test/fixtures/no-explicit-types-property/with-main-other/foo.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare const one: { | ||
(foo: string, bar: string): string; | ||
(foo: number, bar: number): number; | ||
}; | ||
|
||
export default one; |
3 changes: 3 additions & 0 deletions
3
source/test/fixtures/no-explicit-types-property/with-main-other/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports.default = (foo, bar) => { | ||
return foo + bar; | ||
}; |
3 changes: 2 additions & 1 deletion
3
...t-non-barrel-main-via-types/foo.test-d.ts → ...es-property/with-main-other/foo.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import {expectType} from '../../..'; | ||
import {expectType, expectError} from '../../../..'; | ||
import one from './foo'; | ||
|
||
expectType<string>(one('foo', 'bar')); | ||
expectType<number>(one(1, 2)); | ||
expectError(one(1, 2)); |
2 changes: 0 additions & 2 deletions
2
...st-non-barrel-main-via-types/package.json → ...pes-property/with-main-other/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
{ | ||
"name": "foo", | ||
"main": "foo.js", | ||
"types": "foo.d.ts", | ||
"files": [ | ||
"foo.js", | ||
"foo.d.ts" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
source/test/fixtures/no-explicit-types-property/without-main/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare const one: { | ||
(foo: string, bar: string): string; | ||
(foo: number, bar: number): number; | ||
}; | ||
|
||
export default one; |
3 changes: 3 additions & 0 deletions
3
source/test/fixtures/no-explicit-types-property/without-main/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports.default = (foo, bar) => { | ||
return foo + bar; | ||
}; |
6 changes: 6 additions & 0 deletions
6
source/test/fixtures/no-explicit-types-property/without-main/index.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {expectType, expectError} from '../../../..'; | ||
import one from './'; | ||
|
||
expectType<string>(one('foo', 'bar')); | ||
expectType<number>(one(1, 2)); | ||
expectError(one(1, 2)); |
6 changes: 6 additions & 0 deletions
6
source/test/fixtures/no-explicit-types-property/without-main/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "foo", | ||
"files": [ | ||
"index.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters