Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when type definition path is a subpath of a file in files #57

Closed
posva opened this issue Nov 20, 2019 · 6 comments
Closed

Errors when type definition path is a subpath of a file in files #57

posva opened this issue Nov 20, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@posva
Copy link

posva commented Nov 20, 2019

If the type definition file is in a subfolder of a path included in files, tsd will error this message:

package.json:25:2
  ✖  25:2  TypeScript type definition dist/src is not part of the files list.

sample package.json file:

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "types": "dist/src",
  "files": ["dist"],
  "license": "MIT",
  "devDependencies": {
    "tsd": "^0.11.0"
  }
}

Creating an empty file dist/src/index.d.ts alongside this package.json file should be enough to reproduce it 🙂

As a workaround, including dist/src in files works just fine

@SamVerschueren
Copy link
Collaborator

Thanks for posting this. Will have a look :).

@SamVerschueren SamVerschueren added the bug Something isn't working label Nov 23, 2019
@szmarczak
Copy link

@SamVerschueren Friendly ping :) This is quite annoying because I cannot put the declarations file in the source folder...

@SamVerschueren
Copy link
Collaborator

I'll see if I can fix this. Shouldn't be that hard.

@SamVerschueren
Copy link
Collaborator

So I looked into this, and this is already fixed somewhat, see #69 for more information. For instance, the following package.json works.

{
	"name": "foo",
	"files": [
		"out"
	],
	"types": "out/index.d.ts"
}

What doesn't work however, is this

{
	"name": "foo",
	"files": [
		"out"
	],
	"types": "out"
}

When looking at the specs of the types property, it doesn't seem to be meant to provide a directory. So just changing types to out/index.d.ts should work.

Does this fix the issue for both of you @szmarczak and @posva?

@SamVerschueren
Copy link
Collaborator

I'm going to close this, feel free to create a new issue or ask me to reopen it if it's not working as expected.

@szmarczak
Copy link

Yep, it's working as expected. Sorry I haven't told you before, I totally forgot 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants