Exemplo n.º 1
0
        private void Write(IKeyboard keyboard,
                           TsObjectType tsObjectType)
        {
            using (keyboard.Block())
            {
                foreach (var tsTypeMember in tsObjectType.Members)
                {
                    switch (tsTypeMember)
                    {
                    case TsIndexSignature tsIndexSignature:
                        keyboard.Indent()
                        .Type("[key: ")
                        .Write(tsIndexSignature.IndexType)
                        .Type("]: ")
                        .Write(tsIndexSignature.ValueType)
                        .Type(";");
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(tsTypeMember),
                                                              tsTypeMember.GetType().Name,
                                                              null);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Write(IKeyboard keyboard, TsExportKind tsExportKind)
        {
            keyboard.Indent();
            switch (tsExportKind)
            {
            case TsExportKind.None:
                return;

            case TsExportKind.Named:
                keyboard.Type("export ");
                return;

            case TsExportKind.Default:
                keyboard.Type("export default ");
                return;

            default:
                throw new ArgumentOutOfRangeException(nameof(tsExportKind), tsExportKind, null);
            }
        }