body-parser.d.ts 中的打字稿编译错误:找不到符号 'Buffer'
typescript compile error in body-parser.d.ts: Could not find symbol 'Buffer'
我在编译 typescript 文件时在 body-parser.d.ts 中遇到以下编译错误。
错误 TS2095:找不到符号 'Buffer'。
错误 TS2094: 属性 'RequestHandler' 在 'express'.
类型的值上不存在
我的 app.ts 文件中有以下行。
///<reference path='../Scripts/typings/node/node.d.ts'/>
///<reference path='../Scripts/typings/body-parser/body-parser.d.ts'/>
import express = require('express');
import bodyParser = require('body-parser');
import http = require('http');
import path = require('path');
为什么我会收到错误消息?
确保您有 express.d.ts
,因为 body-parser.d.ts
需要它:https://github.com/borisyankov/DefinitelyTyped/blob/master/body-parser/body-parser.d.ts#L6
不太可能是定义中的错误,因为编译 DefinitelyTyped 是为了确保此类错误不会出现在像您这样的用户身上。
我在编译 typescript 文件时在 body-parser.d.ts 中遇到以下编译错误。
错误 TS2095:找不到符号 'Buffer'。 错误 TS2094: 属性 'RequestHandler' 在 'express'.
类型的值上不存在我的 app.ts 文件中有以下行。
///<reference path='../Scripts/typings/node/node.d.ts'/>
///<reference path='../Scripts/typings/body-parser/body-parser.d.ts'/>
import express = require('express');
import bodyParser = require('body-parser');
import http = require('http');
import path = require('path');
为什么我会收到错误消息?
确保您有 express.d.ts
,因为 body-parser.d.ts
需要它:https://github.com/borisyankov/DefinitelyTyped/blob/master/body-parser/body-parser.d.ts#L6
不太可能是定义中的错误,因为编译 DefinitelyTyped 是为了确保此类错误不会出现在像您这样的用户身上。