Sp-dev-docs: Support TypeScript compiler option: noImplicitAny (RC0)

Created on 8 Dec 2016  路  5Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Enhancement / Suggestion
  • [ ] Additional article idea

Expected or Desired Behavior

In my sharepoint framework project (developer preview RC0), I want to use the TypeScript compiler option "noImplicitAny" (in tsconfig.json).

Observed Behavior

Setting the option in tsconfig works fine.
But there are TypeScript errors originating from the sharepoint framework (RC0) which prevent me from using the "noImplicitAny"-option in my project.

See this console output:

位 gulp build
Build target: DEBUG
[15:29:12] Using gulpfile ~\Documents\Projects\spfx-angular-NewCommunicationTypeWizard\gulpfile.js
[15:29:12] Starting gulp
[15:29:12] Starting 'build'...
[15:29:12] Starting subtask 'pre-copy'...
[15:29:12] Finished subtask 'pre-copy' after 27 ms
[15:29:12] Starting subtask 'copyStaticAssets'...
[15:29:12] Starting subtask 'sass'...
[15:29:13] Finished subtask 'sass' after 973 ms
[15:29:13] Starting subtask 'tslint'...
[15:29:13] Starting subtask 'typescript'...
[15:29:13] [typescript] Using custom version: 2.0.10
[15:29:14] Finished subtask 'copyStaticAssets' after 1.68 s
- [15:29:17] Error - typescript - node_modules\@microsoft\sp-core-library\lib\serviceScope\ServiceKey.d.ts(30,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.
- [15:29:17] Error - typescript - node_modules\@microsoft\sp-core-library\lib\serviceScope\ServiceScope.d.ts(69,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.
[15:29:17] Finished subtask 'tslint' after 3.86 s
- [15:29:17] Error - 'typescript' sub task errored after 4.06 s
 "TypeScript error(s) occurred."
[15:29:17] 'build' errored after 5.11 s
[15:29:17]
[15:29:18] ==================[ Finished ]==================
- Error - typescript - node_modules\@microsoft\sp-core-library\lib\serviceScope\ServiceKey.d.ts(30,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.
- Error - typescript - node_modules\@microsoft\sp-core-library\lib\serviceScope\ServiceScope.d.ts(69,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.
- Error - 'typescript' sub task errored after 4.06 s
 "TypeScript error(s) occurred."
[15:29:19] Project new-communication-type-wizard version: 0.0.2
[15:29:19] Build tools version: 1.1.0
[15:29:19] Node version: v6.9.4
[15:29:19] Total duration: 8.86 s
[15:29:19] Task errors: 3

Steps to Reproduce

1) Create a new HelloWorld-Project (yo option: No JavaScript framework)
2) In tsconfig.json add under the section "compilerOptions": "noImplicitAny": true.
3) Build gulp build
4) Observe the output for errors

Thoughts

IMHO the sharepoint framework should be compiled with the strictest settings possible - to allow developers to use the stricter settings on their projects built with this framework.

tracked

Most helpful comment

...or the framework files should be excluded from analysis.

All 5 comments

...or the framework files should be excluded from analysis.

Is still not supported as of now (RC0)

@lahuey @mpasarin What is the status of supporting the noImplicitAny option?

The workaround here is to add the compiler option "skiplibcheck". This will remove checks in spfx code.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karishmaTCS picture karishmaTCS  路  3Comments

jonthenerd picture jonthenerd  路  3Comments

mikeparkie picture mikeparkie  路  3Comments

acksoft picture acksoft  路  3Comments

nanddeepn picture nanddeepn  路  3Comments