-
Notifications
You must be signed in to change notification settings - Fork 1k
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
SPFx Yeoman template broken by TypeScript 2.1 definition in @types/lodash #394
Comments
I'm receiving this same error. Works fine if I choose react for a framework. Is there any resolution yet? |
Me too. |
received the same error... |
I am able to repro this error in a fresh Windows machine. @nickpape-msft @iclanton any ideas whats going on? I tried reinstalling lodash types but that doesn't seem to help. |
I am also getting this problem. I can also get it to work fine if I choose react for a framework. Build target: DEBUG |
This is a regression introduced by DefinitelyTyped PR 13994. As a workaround, you can run this command:
However, IMO it is inappropriate for the upstream PR to introduce a patch-level SemVer change that forces all consumers to immediately upgrade to the TypeScript 2.1 compiler. The PR even failed its Travis build for this reason, but was merged anyway. @mhegazy @lukas-zech-software @andy-ms |
Does SPFX support TypeScript 2.1 ? |
We just finished migrating to TypeScript 2.1 a week ago, but it hasn't been released yet. We're still testing. The 2.0 -> 2.1 migration was actually fairly involved compared to your normal intuition for a "minor" version increment. We'll explain this in more detail when the next release is published. |
So unless PR13994 is reverted, the only way forward is to use npm install @types/[email protected] |
I can confirm that the workaround detailed by pgonzal works successfully with the "Build Your Own WebPart" instructions. |
hi. I am getting the same error even after trying the workaround suggested by pgonzal. I am trying to refer jquery file in my type script file for helloworld webpart using below import syntax. I get the same exception when tried to import moduleloader class using "@microsoft/sp-module-loader". import * as jQuery from 'jquery'; |
I am also receiving this error. Fresh install, first time through the demo. The workaround solves the issue, but wanted to make known that it is still happening. |
see @pgonzal item above |
Hey all,
I made the same as Mark, I choose to react for a framework then it works
…On 28 January 2017 at 23:05, Mark Rackley ***@***.***> wrote:
I'm receiving this same error. Works fine if I choose react for a
framework. Is there any resolution yet?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#394 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUHiY5bMTPxTWbhQHtA-bAq-r6lm2Lkks5rW8mwgaJpZM4LwS1Q>
.
--
*Tarcísio Costa Corte*
*e-mail: [email protected] <[email protected]>*
*Skype: tarcisiocorte*
*Phone: +55 (11) 9 7786 4190*
|
@anishetty when loading the jQuery lib in an RC0 webpart, you also have to load the jQuery typeScript types like so: npm install @types/jquery this should fix you issue. hope this helps |
This is sorted in GA. |
I was just going through the process of creating a hello world client web part and ran into the same problem that everyone else seems to be having. There seem to be a number of workarounds for this issue, none of which appear to work for me. I did npm install @types/[email protected], but now getting: Error - typescript - node_modules@types\es6-collections\index.d.ts(78,29): error TS2304: Cannot find name 'object'. These errors on a basic project have got to be a huge impediment to the adoption of Spfx. Can someone outline in layman terms what is going on here? |
@muirgus Looks like you have an older version of typescript installed. Try updating to at least 2.2. |
Not sure what's happening here: Trying to install v.2.2.2, but comes back with earlier version. λ npm install -g [email protected] c:\dev\helloVue |
Check the output of |
doesn't recognize get-command |
That's what powershell uses. On unix it's |
PS C:\dev\helloVue> get-command tsc CommandType Name Version Source Application tsc.exe 1.7.40.... C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\tsc.exe |
Well, there's your problem. Hopefully you can just adjust your PATH. |
I removed the typescript entry from my PATH but still having issues. c:\dev\helloVue c:\dev\helloVue |
Gulp is probably using a locally installed typescript. Check your |
I think I installed Typescript earlier to explore what it was all about. I am going to uninstall everything and start again tomorrow. |
In NPM with local installation, "uninstall everything" is just |
Typescript has now been updated to 2.2.2, but still getting errors: c:\dev\helloVue c:\dev\helloVue |
|
How would I remove 2.0.10? I don't see how I am creating so many versions. |
Read the npm documentation. You could also just look at |
I am working from a fresh install and am still getting issues. I can understand getting issues when creating a working project, but this makes me really wonder the work involved with sharepoint framework going forward. |
muirgus, I was having the exact same issue and error messages as you. Comparing notes with a colleague, I discovered that he was using a version 4.2.0 of the @Microsoft/sharepoint package while mine was 4.5. All attempts to uninstall the 4.5 failed. I finally uninstalled node from my machine and did a complete reinstall which got me back to the 4.2 and now everything builds and serves without error. Under 4.5, the project was defaulting to typescript 2.0.10. I have no idea how I got on 4.5 |
@muirgus : Could you get past the error? I'm on typescript (tsc -v)2.4.2 and the issue persists. |
By default SPFx doesn't use tsc you have installed globally, but one that is included with SPFx which currently is v2.2.2. Unless you override it specifically, that's the version that you're using, even if you have a newer version of tsc installed on your machine. You can confirm the version used for building the project by running |
The SPFx toolchain ships with a specific version of the TypeScript compiler. There are ways to override it (e.g. via TypeScriptConfiguration.setTypescriptCompiler() in your Gulpfile), however we generally recommend against that, because it will put you in an untested state. For small projects, the compiler doesn't matter that much, but for large code bases pretty much every single compiler upgrade causes some kind of regression or break (in our experience). The best workaround is to downgrade to a version of your typings that is compatible with your compiler. Since @types projects don't follow SemVer and specify their indirect dependencies using a wildcard, in some cases you may need to add an indirect dependency to your package.json file as well. BTW our core toolchain already upgraded to TypeScript 2.4. This will ship in the next release of SPFx, which is right around the corner. |
You're using the pre-release version of the SharePoint Framework. I suggest, you update your SharePoint Framework Yeoman generator to the latest version (v1.1.3 at this moment), create a new project, and either copy your code over to the new one or compare the differences and update your existing project. |
So just to confirm, if I bring in some random package from npm, there's a chance it might not work with SPFx because SPFx is using an older version of Typescript and the typings for packages I bring in might be too up to date for SPFx to keep up with? Right now I'm trying to use Axios which is a very popular React Http client but it won't work because:
|
At the moment, yes. We're working on a system that will allow people to define an updated version of typescript, while still making sure that the various pieces of the toolchain are reliable. |
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues |
Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.
Category
Expected or Desired Behavior
I was just creating a Hellow world with SharePoint Framework
Step 1
yo @microsoft/sharepoint
step 2
lp trust-dev-cert
step 3
gulp serve
----the error showed up
Observed Behavior
Steps to Reproduce
I create a helloworld folder (Windows 10)
open cmdlet and typed
yo @microsoft/sharepoint
lp trust-dev-cert
gulp serve
Build target: DEBUG
[22:33:22] Using gulpfile c:\dev\helloworld_2\gulpfile.js
[22:33:22] Starting gulp
[22:33:22] Starting 'default'...
[22:33:22] Starting subtask 'pre-copy'...
[22:33:22] Finished subtask 'pre-copy' after 14 ms
[22:33:22] Starting subtask 'copyStaticAssets'...
[22:33:22] Starting subtask 'sass'...
[22:33:23] Finished subtask 'sass' after 720 ms
[22:33:23] Starting subtask 'tslint'...
[22:33:23] Starting subtask 'typescript'...
[22:33:23] [typescript] Using custom version: 2.0.10
[22:33:23] Finished subtask 'copyStaticAssets' after 810 ms
[22:33:26] Error - typescript - node_modules@types\lodash\index.d.ts(245,25): error TS2304: Cannot find name 'Partial'.
[22:33:26] Finished subtask 'tslint' after 3.15 s
[22:33:26] Error - 'typescript' sub task errored after 3.15 s
"TypeScript error(s) occurred."
[22:33:26] 'default' errored after 3.93 s
[22:33:26]
[22:33:27] ==================[ Finished ]==================
Error - typescript - node_modules@types\lodash\index.d.ts(245,25): error TS2304: Cannot find name 'Partial'.
Error - 'typescript' sub task errored after 3.15 s
"TypeScript error(s) occurred."
[22:33:27] Project helloworld-2 version: 0.0.1
[22:33:27] Build tools version: 1.1.0
[22:33:27] Node version: v6.4.0
[22:33:27] Total duration: 7.25 s
[22:33:27] Task errors: 2
The text was updated successfully, but these errors were encountered: