Skip to content

Remove typings dependencies#12

Merged
blakeembrey merged 4 commits intoblakeembrey:masterfrom
unional:master
Jul 20, 2016
Merged

Remove typings dependencies#12
blakeembrey merged 4 commits intoblakeembrey:masterfrom
unional:master

Conversation

@unional
Copy link
Copy Markdown
Contributor

@unional unional commented Jul 20, 2016

[email protected] now comes with typings, so typings.json is no longer needed for distribution.

Also, "LICENSE" is always included thus no need to keep in the files: [] array.

Also updated typings version to 1.3.1

🌷

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 20, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 6e7a0b6 on unional:master into 846051e on blakeembrey:master.

@blakeembrey
Copy link
Copy Markdown
Owner

Thanks.

@blakeembrey blakeembrey merged commit 8eb6ec7 into blakeembrey:master Jul 20, 2016
@blakeembrey
Copy link
Copy Markdown
Owner

Shoot. This just broke a dozen dependencies. Trying to short out why now. I think the missing typings field broke Typings, but it seems like more than that also.

@blakeembrey
Copy link
Copy Markdown
Owner

Oh, I see. I should not have published this. When you remove typings.json, just need to remember to add back typings to package.json - right now anyone using this will be broken. Updating now.

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 20, 2016

Sorry. It's weird. The error from popsicle:

error TS2318: Cannot find global type 'Array'.
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'Function'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'Number'.
error TS2318: Cannot find global type 'Object'.
error TS2318: Cannot find global type 'RegExp'.
error TS2318: Cannot find global type 'String'.

Seems like it can't load libs.

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 20, 2016

When you remove typings.json, just need to remember to add back typings to package.json

I tried it by npm i github:unional/error-cause and tsc language service can load the typings fine.

I thought the tsc resolution will automatically look for .d.ts next to dist/index.js?

@blakeembrey
Copy link
Copy Markdown
Owner

Hmm, I don't think so. I think it only looks for a root index.d.ts? I could be wrong I suppose.

@blakeembrey
Copy link
Copy Markdown
Owner

Yep, adding the typings field back to package.json has fixed it.

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 20, 2016

weird. I just tried 1.2.0 and tsc didn't complain.

@blakeembrey
Copy link
Copy Markdown
Owner

@blakeembrey
Copy link
Copy Markdown
Owner

Actually, shoot, it goes much deeper. I accidentally just broke Typings core also 😦 Typings doesn't follow the index.d.ts file like TypeScript does, so the omission of it actually broke any module using Typings. I'll try to push an update to Typings core to support this, but 😦 😦 😦

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 21, 2016

It's good that we find a bug. 😏

I'm testing on jspm-config and it does seem to work locally. Trying on travis.

@blakeembrey
Copy link
Copy Markdown
Owner

Sadly it wasn't a bug originally. It's how I designed it to work. With Typings, it falls back to resolving based on package.json's main and not index.d.ts. This was because a Typings dependency can't set typings and people may not set their typings.json/main file. So, basically, I think fixing this will break most users of Typings 😦

@blakeembrey
Copy link
Copy Markdown
Owner

Actually, this issue is more exacerbated because there's no main in that module either. I'll have to think about how to resolve this without breaking everything for now...

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 21, 2016

I don't have much luck on travis. On Travis it error out "as it should", can't find module make-error-cause.

But locally it is definitely working. I removed node_modules and reinstall to make sure it gets the right tsc, and it just compiles fine...

@blakeembrey
Copy link
Copy Markdown
Owner

Make sure you pruned your typings.

@blakeembrey
Copy link
Copy Markdown
Owner

I think I have a temporary solution. If it's trying to resolve the entry file and none exists, I'll use index.d.ts. However, this doesn't bring it in line with TypeScript - that's a whole other huge breaking change.

@blakeembrey
Copy link
Copy Markdown
Owner

Got it working with typings/core@a599740.

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 21, 2016

You are right with the typings folder.

I wonder if this resolution on tsc is intentional or bug. When resolve files relatively, it reads the .d.ts file next to the .js file, why doesn't it do the same for package.json/main? The path in there is also relative.

@unional
Copy link
Copy Markdown
Contributor Author

unional commented Jul 21, 2016

Nice. The output is actually simpler :)

@blakeembrey
Copy link
Copy Markdown
Owner

No idea, it does seem a tad inconsistent. Probably a good idea to bring it up with the TypeScript team, I can't see anything about it but probably haven't got the right search terms.

@blakeembrey
Copy link
Copy Markdown
Owner

Nice. The output is actually simpler :)

Haha, thanks. It's mostly circumstantial though, I realised there was a clearer way to write some things and that isTypings behaviour wasn't exclusive to "is typings".

@blakeembrey
Copy link
Copy Markdown
Owner

The crux of the fix was actually just passing originalPath around to track whether this was the entry file, instead of comparing to what we "thought" was the entry file. This allowed entry to fallback on index.d.ts without breaking everything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants