小编Sem*_*tus的帖子

错误 TS1219:对装饰器的实验性支持是一项功能,在未来版本中可能会发生变化

在最新的 Visual Studio 2015 中,ASP.NET Core Web 应用程序项目无法修复此错误:

Scripts\app\AppComponent.component.ts(7,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Scripts\app\app.component.ts(7,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Scripts\app\app.module.ts(16,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net visual-studio visual-studio-2015

4
推荐指数
2
解决办法
9219
查看次数

axios-mock-adapter 如果我模拟请求,则仅适用于我模拟的请求

我正在尝试模拟尚未在服务器上实现的 API。但是,如果我模拟请求,则仅适用于我模拟的请求。如果我在mock.restore();之后添加,mock.onGet那么真正的 API 工作正常,但是我也不需要模拟 API。

import * as axios from 'axios';
import MockAdapter from 'axios-mock-adapter';

const mainConfig = require('../../../config/main.js');

const request = (axios as any).create({
  baseURL: mainConfig.apiBaseUrl,
  headers: {
    'Content-Type': 'application/json',
  },
});

const mock = new MockAdapter(request);

mock.onGet('basket').reply(200, {...});

export default request;
Run Code Online (Sandbox Code Playgroud)

mocking typescript ecmascript-6 axios axios-mock-adapter

1
推荐指数
1
解决办法
2007
查看次数