Я получаю следующее иногда, когда я компилирую с помощью Бодрствующего файла WebStorm, который работает TSC:машинопись ошибки 1.3 иногда давая ложные типа неправильно матч
../paragraph/paragraph.ts(193,29): error TS2345: Argument of type 'TYPE' is not assignable to parameter of type 'TYPE'.
../paragraph/paragraph.ts(255,75): error TS2345: Argument of type 'Paragraph' is not assignable to parameter of type 'Paragraph'.
../paragraph/tab.ts(241,37): error TS2345: Argument of type 'ArrayList<TabAttributes>' is not assignable to parameter of type 'ArrayList<TabAttributes>'.
Type 'TabAttributes' is not assignable to type 'TabAttributes'.
я получаю около 20 из них. При компиляции с использованием VS2013 никаких проблем. Когда я запускаю код, никаких проблем. Но компилятор, похоже, задыхается от кучи этого материала. Это только началось, когда мы обновили до машинописного текста 1.3.
Уточнение: Когда я делаю сборку с использованием VisualStudio, я не получаю никаких ошибок или предупреждений от компиляции машинописного текста. Когда WebStorm компилируется, я иногда получаю его. Но WebStorm просто передает выход компилятора обратно на дисплей.
Что происходит?
Update - вот выход компиляции в окне DOS:
C:\src\jenova\Dev\Merge\AutoTagWeb\client\scripts\layout\document\elements\parag
raph>tsc --target ES5 --module amd --sourcemap paragraph.ts
../../../document/elements/paragraph/line.ts(127,41): error TS2339: Property 'LI
NE' does not exist on type 'typeof TYPE'.
../../../document/elements/position.ts(75,40): error TS2339: Property 'POSITION'
does not exist on type 'typeof TYPE'.
../../../document/elements/position.ts(184,59): error TS2339: Property 'ABSOLUTE
_POSITION' does not exist on type 'typeof TYPE'.
../../../document/elements/position.ts(193,40): error TS2339: Property 'ABSOLUTE
_POSITION' does not exist on type 'typeof TYPE'.
../../../document/elements/run/run.ts(57,40): error TS2339: Property 'RUN_ELEMEN
T' does not exist on type 'typeof TYPE'.
../../../document/list-body.ts(537,41): error TS2339: Property 'LINE' does not e
xist on type 'typeof TYPE'.
../../../final-format.ts(719,62): error TS2339: Property 'LINE' does not exist o
n type 'typeof TYPE'.
../../../handlers/para-handler.ts(510,52): error TS2339: Property 'RUN_ELEMENT'
does not exist on type 'typeof TYPE'.
../../../handlers/para-handler.ts(522,51): error TS2339: Property 'BLOCK' does n
ot exist on type 'typeof TYPE'.
../../../handlers/para-handler.ts(565,52): error TS2339: Property 'RUN_ELEMENT'
does not exist on type 'typeof TYPE'.
../../../handlers/para-handler.ts(570,52): error TS2339: Property 'BLOCK' does n
ot exist on type 'typeof TYPE'.
../../../handlers/text-handler.ts(63,42): error TS2339: Property 'RUN_ELEMENT' d
oes not exist on type 'typeof TYPE'.
../../../handlers/text-handler.ts(99,42): error TS2339: Property 'LINE' does not
exist on type 'typeof TYPE'.
../../../handlers/text-handler.ts(108,41): error TS2339: Property 'BLOCK' does n
ot exist on type 'typeof TYPE'.
../../../handlers/text-handler.ts(561,39): error TS2339: Property 'POSITION' doe
s not exist on type 'typeof TYPE'.
../../../handlers/text-handler.ts(571,39): error TS2339: Property 'LINE' does no
t exist on type 'typeof TYPE'.
../../elements/paragraph/line.ts(127,41): error TS2339: Property 'LINE' does not
exist on type 'typeof TYPE'.
../../elements/position.ts(75,40): error TS2339: Property 'POSITION' does not ex
ist on type 'typeof TYPE'.
../../elements/position.ts(184,59): error TS2339: Property 'ABSOLUTE_POSITION' d
oes not exist on type 'typeof TYPE'.
../../elements/position.ts(193,40): error TS2339: Property 'ABSOLUTE_POSITION' d
oes not exist on type 'typeof TYPE'.
../../elements/run/run.ts(57,40): error TS2339: Property 'RUN_ELEMENT' does not
exist on type 'typeof TYPE'.
../../list-body.ts(537,41): error TS2339: Property 'LINE' does not exist on type
'typeof TYPE'.
../paragraph/line.ts(127,41): error TS2339: Property 'LINE' does not exist on ty
pe 'typeof TYPE'.
../paragraph/paragraph-properties.ts(429,14): error TS2421: Class 'ParagraphProp
ertyValues' incorrectly implements interface 'IParagraphPropertyValues':
Types of property 'parent' are incompatible:
Type 'Paragraph' is not assignable to type 'IParagraph':
Types of property 'type' are incompatible:
Type 'TYPE' is not assignable to type 'TYPE'.
../paragraph/paragraph.ts(94,14): error TS2416: Class 'Paragraph' incorrectly ex
tends base class 'Line':
Types of property 'isType' are incompatible:
Type '(type: TYPE) => boolean' is not assignable to type '(type: TYPE) => bo
olean':
Types of parameters 'type' and 'type' are incompatible:
Type 'TYPE' is not assignable to type 'TYPE'.
../paragraph/paragraph.ts(94,14): error TS2421: Class 'Paragraph' incorrectly im
plements interface 'IParagraph':
Types of property 'props' are incompatible:
Type 'ParagraphPropertyValues' is not assignable to type 'IParagraphProperty
Values'.
../paragraph/paragraph.ts(193,29): error TS2345: Argument of type 'TYPE' is not
assignable to parameter of type 'TYPE'.
../paragraph/paragraph.ts(230,13): error TS2323: Type 'Paragraph' is not assigna
ble to type 'IParagraph'.
../paragraph/paragraph.ts(248,34): error TS2353: Neither type 'IParagraphPropert
yValues' nor type 'ParagraphPropertyValues' is assignable to the other:
Property 'className' is missing in type 'IParagraphPropertyValues'.
../paragraph/paragraph.ts(255,75): error TS2345: Argument of type 'Paragraph' is
not assignable to parameter of type 'Paragraph'.
../paragraph/paragraph.ts(274,22): error TS2345: Argument of type 'Paragraph' is
not assignable to parameter of type 'Line'.
../paragraph/paragraph.ts(306,30): error TS2345: Argument of type 'Paragraph' is
not assignable to parameter of type 'IParagraph'.
../paragraph/paragraph.ts(385,13): error TS2365: Operator '!==' cannot be applie
d to types 'SUFFIX' and 'SUFFIX'.
../paragraph/paragraph.ts(386,17): error TS2365: Operator '===' cannot be applie
d to types 'SUFFIX' and 'SUFFIX'.
../paragraph/paragraph.ts(562,41): error TS2345: Argument of type 'Paragraph' is
not assignable to parameter of type 'Line'.
../paragraph/paragraph.ts(602,28): error TS2353: Neither type 'Element' nor type
'RunProperties' is assignable to the other:
Types of property 'type' are incompatible:
Type 'TYPE' is not assignable to type 'TYPE'.
../paragraph/paragraph.ts(619,36): error TS2345: Argument of type 'RunProperties
' is not assignable to parameter of type 'Element[]'.
../paragraph/paragraph.ts(622,51): error TS2345: Argument of type 'RunProperties
' is not assignable to parameter of type 'Element[]'.
../paragraph/paragraph.ts(636,15): error TS2353: Neither type 'Element' nor type
'RunPropertyValues' is assignable to the other:
Property 'parent' is missing in type 'Element'.
../paragraph/paragraph.ts(695,16): error TS2353: Neither type 'Element' nor type
'Paragraph' is assignable to the other:
Property 'docHeader' is missing in type 'Element'.
../paragraph/tab.ts(241,37): error TS2345: Argument of type 'ArrayList<TabAttrib
utes>' is not assignable to parameter of type 'ArrayList<TabAttributes>'.
Type 'TabAttributes' is not assignable to type 'TabAttributes'.
../paragraph/tab.ts(295,60): error TS2345: Argument of type 'ArrayList<TabAttrib
utes>' is not assignable to parameter of type 'ArrayList<TabAttributes>'.
Type 'TabAttributes' is not assignable to type 'TabAttributes'.
../position.ts(75,40): error TS2339: Property 'POSITION' does not exist on type
'typeof TYPE'.
../position.ts(184,59): error TS2339: Property 'ABSOLUTE_POSITION' does not exis
t on type 'typeof TYPE'.
../position.ts(193,40): error TS2339: Property 'ABSOLUTE_POSITION' does not exis
t on type 'typeof TYPE'.
../run/run-properties.ts(729,46): error TS2345: Argument of type 'REGION' is not
assignable to parameter of type 'REGION'.
../run/run.ts(57,40): error TS2339: Property 'RUN_ELEMENT' does not exist on typ
e 'typeof TYPE'.
../section.ts(395,59): error TS2345: Argument of type 'Section' is not assignabl
e to parameter of type 'Section'.
../section.ts(792,67): error TS2345: Argument of type 'Section' is not assignabl
e to parameter of type 'Section'.
../table/table.ts(133,16): error TS2353: Neither type 'Element' nor type 'Row' i
s assignable to the other:
Property 'props' is missing in type 'Element'.
line.ts(127,41): error TS2339: Property 'LINE' does not exist on type 'typeof TY
PE'.
paragraph-properties.ts(429,14): error TS2421: Class 'ParagraphPropertyValues' i
ncorrectly implements interface 'IParagraphPropertyValues':
Types of property 'parent' are incompatible:
Type 'Paragraph' is not assignable to type 'IParagraph':
Types of property 'type' are incompatible:
Type 'TYPE' is not assignable to type 'TYPE'.
paragraph.ts(94,14): error TS2416: Class 'Paragraph' incorrectly extends base cl
ass 'Line':
Types of property 'isType' are incompatible:
Type '(type: TYPE) => boolean' is not assignable to type '(type: TYPE) => bo
olean':
Types of parameters 'type' and 'type' are incompatible:
Type 'TYPE' is not assignable to type 'TYPE'.
paragraph.ts(94,14): error TS2421: Class 'Paragraph' incorrectly implements inte
rface 'IParagraph':
Types of property 'props' are incompatible:
Type 'ParagraphPropertyValues' is not assignable to type 'IParagraphProperty
Values'.
paragraph.ts(193,29): error TS2345: Argument of type 'TYPE' is not assignable to
parameter of type 'TYPE'.
paragraph.ts(230,13): error TS2323: Type 'Paragraph' is not assignable to type '
IParagraph'.
paragraph.ts(248,34): error TS2353: Neither type 'IParagraphPropertyValues' nor
type 'ParagraphPropertyValues' is assignable to the other:
Property 'className' is missing in type 'IParagraphPropertyValues'.
paragraph.ts(255,75): error TS2345: Argument of type 'Paragraph' is not assignab
le to parameter of type 'Paragraph'.
paragraph.ts(274,22): error TS2345: Argument of type 'Paragraph' is not assignab
le to parameter of type 'Line'.
paragraph.ts(306,30): error TS2345: Argument of type 'Paragraph' is not assignab
le to parameter of type 'IParagraph'.
paragraph.ts(385,13): error TS2365: Operator '!==' cannot be applied to types 'S
UFFIX' and 'SUFFIX'.
paragraph.ts(386,17): error TS2365: Operator '===' cannot be applied to types 'S
UFFIX' and 'SUFFIX'.
paragraph.ts(562,41): error TS2345: Argument of type 'Paragraph' is not assignab
le to parameter of type 'Line'.
paragraph.ts(602,28): error TS2352: Neither type 'Element' nor type 'RunProperti
es' is assignable to the other.
paragraph.ts(619,36): error TS2345: Argument of type 'RunProperties' is not assi
gnable to parameter of type 'Element[]'.
paragraph.ts(622,51): error TS2345: Argument of type 'RunProperties' is not assi
gnable to parameter of type 'Element[]'.
paragraph.ts(636,15): error TS2352: Neither type 'Element' nor type 'RunProperty
Values' is assignable to the other.
paragraph.ts(695,16): error TS2353: Neither type 'Element' nor type 'Paragraph'
is assignable to the other:
Property 'docHeader' is missing in type 'Element'.
tab.ts(241,37): error TS2345: Argument of type 'ArrayList<TabAttributes>' is not
assignable to parameter of type 'ArrayList<TabAttributes>'.
Type 'TabAttributes' is not assignable to type 'TabAttributes'.
tab.ts(295,60): error TS2345: Argument of type 'ArrayList<TabAttributes>' is not
assignable to parameter of type 'ArrayList<TabAttributes>'.
Type 'TabAttributes' is not assignable to type 'TabAttributes'.
Чтобы уточнить, если вы запускаете компилятор TS 1.3 через визуальную студию, он не дает этого сообщения, только когда вы запускаете его из webstorm? Или вы имели в виду, что когда вы сохраняете файл в visual studio, он все еще правильно создает файл js, но делает ошибку? – John
@John - обновил Q, чтобы уточнить. –
Можете ли вы воспроизвести эти ошибки в компиляторе командной строки (tsc.exe или tsc.js)? –