I'm currently working on a SharePoint framework project that has the following folder layout:
One of the directories is named dataaccess and contains a webpart factory method.
The file Sharepointdataprovider.ts includes this code snippet:
import {
SPHttpClient,
SPHttpClientBatch,
SPHttpClientResponse
} from '@microsoft/sp-http';
import { IWebPartContext } from '@microsoft/sp-webpart-base';
import List from '../models/List';
import IDataProvider from './IDataProvider';
...
In my gulpfile.js, the setup looks like this:
'use strict';
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
...
// required variables to make configuration easier on the gulp tasks below
...
However, when attempting to run:
gulp update-spdataaccess-typings
It results in the following errors:
src\libraries\spdataaccess\dataproviders\sharepointDataProvider.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
src\libraries\spdataaccess\dataproviders\sharepointDataProvider.ts(25,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
src\libraries\spdataaccess\dataproviders\sharepointDataProvider.ts(29,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
src\libraries\spdataaccess\dataproviders\sharepointDataProvider.ts(34,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
Despite having a seemingly correct tsconfig.json file:
{
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"types": [
"es6-promise",
"es6-collections",
"webpack-env"
]
}
}