Namespace declaration not defined when running ng serve, but intellisense does pick it up
I am working with the Azure Atlas library and decided to make my own typings for the third party library. I have defined a typings file atlas.d.ts
in the project structure, which intellisense in VS Code does pick up and allow me to use the typings. The problem is, upon running ng serve
, I get an error:
ReferenceError: atlas is not defined
In the typings I simply declared a namespace as such:
declare namespace atlas {
// ... Rest of the the interfaces and classes here
}
The issue is that I have read all the documentation on implementing global namespaces or modules in typescript as well as read through a couple of stack overflow posts, modifying the tsconfig
to take into account the atlas.d.ts
file, even though the Angular-CLI ts config out of the box will already include all typings files, but no luck.
Any idea as to what could be causing ng serve
to not take typings into account? You can find the repo I am working with here
angular typescript angular-cli typescript-typings
add a comment |
I am working with the Azure Atlas library and decided to make my own typings for the third party library. I have defined a typings file atlas.d.ts
in the project structure, which intellisense in VS Code does pick up and allow me to use the typings. The problem is, upon running ng serve
, I get an error:
ReferenceError: atlas is not defined
In the typings I simply declared a namespace as such:
declare namespace atlas {
// ... Rest of the the interfaces and classes here
}
The issue is that I have read all the documentation on implementing global namespaces or modules in typescript as well as read through a couple of stack overflow posts, modifying the tsconfig
to take into account the atlas.d.ts
file, even though the Angular-CLI ts config out of the box will already include all typings files, but no luck.
Any idea as to what could be causing ng serve
to not take typings into account? You can find the repo I am working with here
angular typescript angular-cli typescript-typings
add a comment |
I am working with the Azure Atlas library and decided to make my own typings for the third party library. I have defined a typings file atlas.d.ts
in the project structure, which intellisense in VS Code does pick up and allow me to use the typings. The problem is, upon running ng serve
, I get an error:
ReferenceError: atlas is not defined
In the typings I simply declared a namespace as such:
declare namespace atlas {
// ... Rest of the the interfaces and classes here
}
The issue is that I have read all the documentation on implementing global namespaces or modules in typescript as well as read through a couple of stack overflow posts, modifying the tsconfig
to take into account the atlas.d.ts
file, even though the Angular-CLI ts config out of the box will already include all typings files, but no luck.
Any idea as to what could be causing ng serve
to not take typings into account? You can find the repo I am working with here
angular typescript angular-cli typescript-typings
I am working with the Azure Atlas library and decided to make my own typings for the third party library. I have defined a typings file atlas.d.ts
in the project structure, which intellisense in VS Code does pick up and allow me to use the typings. The problem is, upon running ng serve
, I get an error:
ReferenceError: atlas is not defined
In the typings I simply declared a namespace as such:
declare namespace atlas {
// ... Rest of the the interfaces and classes here
}
The issue is that I have read all the documentation on implementing global namespaces or modules in typescript as well as read through a couple of stack overflow posts, modifying the tsconfig
to take into account the atlas.d.ts
file, even though the Angular-CLI ts config out of the box will already include all typings files, but no luck.
Any idea as to what could be causing ng serve
to not take typings into account? You can find the repo I am working with here
angular typescript angular-cli typescript-typings
angular typescript angular-cli typescript-typings
edited Dec 27 '18 at 16:40
marc_s
570k12811031251
570k12811031251
asked Dec 27 '18 at 16:21
Xavid Ramirez
16617
16617
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
So I solved the issue. I am not sure why this works but it does. The way I set up the project was, I would lazy load in the dependency resources into the project only when the Atlas Map needed to be rendered. As per the Azure Atlas documentation here. I need to have the Azure Maps Script and Stylesheet in the Head of the index.html file for the project, which is what I was going to do dynamically when the map was needed. But in order to get the namespace to work, I manually added these two lines into the HEAD of my index.html file at the root of the project and now the atlas namespace I defined is recognized.
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If anyone can give me some insight as to why this is the case? I am really interested as to why angular flipped on my own defined namespace and would not recognize it until I added the library that the typings would be registered for, even if they hadn't been needed yet.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53947950%2fnamespace-declaration-not-defined-when-running-ng-serve-but-intellisense-does-p%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So I solved the issue. I am not sure why this works but it does. The way I set up the project was, I would lazy load in the dependency resources into the project only when the Atlas Map needed to be rendered. As per the Azure Atlas documentation here. I need to have the Azure Maps Script and Stylesheet in the Head of the index.html file for the project, which is what I was going to do dynamically when the map was needed. But in order to get the namespace to work, I manually added these two lines into the HEAD of my index.html file at the root of the project and now the atlas namespace I defined is recognized.
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If anyone can give me some insight as to why this is the case? I am really interested as to why angular flipped on my own defined namespace and would not recognize it until I added the library that the typings would be registered for, even if they hadn't been needed yet.
add a comment |
So I solved the issue. I am not sure why this works but it does. The way I set up the project was, I would lazy load in the dependency resources into the project only when the Atlas Map needed to be rendered. As per the Azure Atlas documentation here. I need to have the Azure Maps Script and Stylesheet in the Head of the index.html file for the project, which is what I was going to do dynamically when the map was needed. But in order to get the namespace to work, I manually added these two lines into the HEAD of my index.html file at the root of the project and now the atlas namespace I defined is recognized.
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If anyone can give me some insight as to why this is the case? I am really interested as to why angular flipped on my own defined namespace and would not recognize it until I added the library that the typings would be registered for, even if they hadn't been needed yet.
add a comment |
So I solved the issue. I am not sure why this works but it does. The way I set up the project was, I would lazy load in the dependency resources into the project only when the Atlas Map needed to be rendered. As per the Azure Atlas documentation here. I need to have the Azure Maps Script and Stylesheet in the Head of the index.html file for the project, which is what I was going to do dynamically when the map was needed. But in order to get the namespace to work, I manually added these two lines into the HEAD of my index.html file at the root of the project and now the atlas namespace I defined is recognized.
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If anyone can give me some insight as to why this is the case? I am really interested as to why angular flipped on my own defined namespace and would not recognize it until I added the library that the typings would be registered for, even if they hadn't been needed yet.
So I solved the issue. I am not sure why this works but it does. The way I set up the project was, I would lazy load in the dependency resources into the project only when the Atlas Map needed to be rendered. As per the Azure Atlas documentation here. I need to have the Azure Maps Script and Stylesheet in the Head of the index.html file for the project, which is what I was going to do dynamically when the map was needed. But in order to get the namespace to work, I manually added these two lines into the HEAD of my index.html file at the root of the project and now the atlas namespace I defined is recognized.
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/css/atlas.min.css?api-version=1" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/js/atlas.min.js?api-version=1"></script>
If anyone can give me some insight as to why this is the case? I am really interested as to why angular flipped on my own defined namespace and would not recognize it until I added the library that the typings would be registered for, even if they hadn't been needed yet.
answered Dec 28 '18 at 14:32
Xavid Ramirez
16617
16617
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53947950%2fnamespace-declaration-not-defined-when-running-ng-serve-but-intellisense-does-p%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown