angular-material: fix declarations to properly augment angular namespace when importing the types via npm #10065
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
case 2. Improvement to existing type definition.
I couldn't get the
angular-material
typings to work withangular
when using TS 2.0 with the@types
typings. My code was able to seeangular
, but notangular.material
. I reviewed the new documents in the TypeScript Handbook regarding Definition files and came to the conclusion that since the angular-material library modifies the globalangular
, the typings for it should follow the pattern of a global plugin (see https://github.com/Microsoft/TypeScript-Handbook/blob/release-2.0/pages/declaration%20files/Library%20Structures.md#global-plugin). After making these changes to the types in my project, I was finally able to get types off of bothangular
andangular.material
.I haven't been able to verify that the build passes since the Travis build for this branch is broken right now, but I would be happy to verify in any way I can that these changes are valid.
I'm not sure if I'm going about this the right way, but any direction at this point would be helpful :)
P.S. In the DT repo when I am editing the files it doesn't seem to know how to resolve
/// <reference types="..." />
references. Is there any way to make that work? (I have my VSCode pointing to my local installation of TS 2.0.)